Custom Fields
Re-Envisioned
Support Meta Box Updater License key warning

This topic contains 12 replies, has 2 voices, and was last updated by  Anh Tran 2 months, 3 weeks ago.

  • Creator
    Topic
  • #15544
    Resolved
    Ignite
    Participant

    We purchased a key for a premium plugin which is used on about 800 websites and have just noticed there is now a warning for the key to be added manually for plugin updates to continue when it was previously saved.

    The plugin’s support ends in Sep 2019 so it should still be valid.

    Is there any way to add the key back in via a function call without doing this manually in the CMS?

Viewing 10 replies - 1 through 10 (of 12 total)
  • Author
    Replies
  • #15559

    Anh Tran
    Keymaster

    Hi Ignite,

    Yes, you can set the license key programmatically with this code:

    add_filter( 'option_meta_box_updater', function( $value ) {
        if ( ! is_array( $value ) ) {
            $value = [];
        }
        $value['api_key'] = 'YOUR API KEY';
        return $value;
    } );
    #15568

    Ignite
    Participant

    Hi Anh

    Thanks but this isn’t working.

    I’ve realised we don’t actually have the separate updater plugin. Is there a hook to do this with just ‘Meta Box’ and ‘Meta Box Include Exclude’ installed?

    #15570

    Anh Tran
    Keymaster

    The updater is merged into Meta Box, so no need to install it separately.

    I’m not clear about “with just Meta Box & Meta Box Include Exclude”. Did you mean enable updates only for these plugins?

    #15571

    Ignite
    Participant

    Hi Anh

    So we have just “Meta Box & Meta Box Include Exclude” plugins installed, we don’t have the plugin https://metabox.io/plugins/meta-box-updater/ and I think that’s maybe why the code you gave is not working.

    #15572

    Anh Tran
    Keymaster

    I got it. As I said in the previous reply, the Meta Box Updater is merged into Meta Box 5.0.0. If you’re using Meta Box 5.0.0+, then you already have it.

    Please try the updated code:

    add_filter( 'option_meta_box_updater', function( $value ) {
        if ( ! is_array( $value ) ) {
            $value = [];
        }
        $value['api_key'] = 'YOUR LICENSE KEY';
        $value['status'] = 'success';
        return $value;
    } );
    #15573

    Ignite
    Participant

    Yes, using MetaBox 5.0.1

    I tried with updated code but still get the message to say license needs adding.

    Even if put

    add_filter( 'option_meta_box_updater', function( $value ) {
    echo 'test';
    } );

    There is no ‘test’ displayed so I think the hook is not being triggered.

    I just looked at the plugin code and tried this to see if I could set the key using update_site_option

    $option = is_multisite() ? get_site_option( 'meta_box_updater' ) : get_option( 'meta_box_updater' );
    print_r($option);

    This outputs nothing also which is strange as I’m sure this should return something.

    #15575

    Anh Tran
    Keymaster

    Are you using Multisite or single install?

    #15576

    Ignite
    Participant

    Single site

    #15577

    Anh Tran
    Keymaster

    Hmm, that’s strange. I tested the code with my localhost and it works for me. Can you check again to make sure your API key is correct? And where did you put the code?

    #15578

    Ignite
    Participant

    Code is in functions.php

    I’ve dumped all site options and looked at /wp-admin/options.php where I can see data is reserved for all of the other plugins on the site but there’s nothing showing for meta_box_updater.

    Not sure if it makes any difference but whilst the site is using Meta Box 5.0.1 it was using a much older version from a couple of years ago that’s been updated along the way.

    The license key is valid for another month. If I add it manually then the warning goes away but obviously don’t want to be doing that on 800 sites individually.

Viewing 10 replies - 1 through 10 (of 12 total)

You must be logged in to reply to this topic.