diggy / polylang-cli

WP-CLI community package of Polylang commands
https://github.com/diggy/polylang-cli
MIT License
34 stars 19 forks source link

Command to set the license for polylang pro #113

Open mvanmeerbeck opened 7 years ago

mvanmeerbeck commented 7 years ago

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!

diggy commented 7 years ago

sure, any suggestions as to implementation?

tditlu commented 6 years ago

@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.phpi then have this define:

define('POLYLANG_PRO_LICENSE_KEY', 'xxxxxxxxxxxxxxxx');

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

diggy commented 6 years ago

@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 :)