polylang-cli icon indicating copy to clipboard operation
polylang-cli copied to clipboard

Command to set the license for polylang pro

Open mvanmeerbeck opened this issue 8 years ago • 3 comments

Hi,

I'm using the pro version of polylang and i'm willing to set the license through the wp-cli but the option doesn't appear after:

wp pll option list

In fact, this option is under another namespace wp option list | grep license

polylang_licenses

Is there anyway to handle that ?

Thanks!

mvanmeerbeck avatar Oct 30 '17 20:10 mvanmeerbeck

sure, any suggestions as to implementation?

diggy avatar Oct 31 '17 08:10 diggy

@diggy: I also had a problem with this, solved it by calling activate_license, if $licenses['polylang-pro']['key'] was not set:

if (defined('POLYLANG_PRO') && defined('POLYLANG_PRO_LICENSE_KEY') && !empty(POLYLANG_PRO_LICENSE_KEY)) {
    add_action('after_setup_theme', function() {
        $licenses = get_option('polylang_licenses');
        if (empty($licenses['polylang-pro']['key'])) {
            $license = new PLL_License(POLYLANG_FILE, 'Polylang Pro', POLYLANG_VERSION, 'Frédéric Demarle');
            $license->activate_license(POLYLANG_PRO_LICENSE_KEY);
        }
    });
}

In my wp-config.php i then have this define:

define('POLYLANG_PRO_LICENSE_KEY', 'xxxxxxxxxxxxxxxx');

Something similar could be implemented in polylang-cli...

tditlu avatar Jun 04 '18 08:06 tditlu

@tditlu I'm not a PLL pro user, so I'm not sure if I'm in the best position to implement this. Of course, I welcome a PR that fixes your problem :)

diggy avatar Jun 15 '18 12:06 diggy