- This topic has 10 replies, 3 voices, and was last updated 2 years, 4 months ago by
Tom.
-
AuthorPosts
-
February 22, 2023 at 11:58 pm #2543562
Stew
I use WP CLI to install/setup WordPress and install plugins/themes, and I’ve noticed that when I do a fresh setup with GP Premium installed, I see the following PHP warning at the top of the Dashboard after logging in (but it disappears on subsequent page loads):
Warning: Trying to access array offset on value of type bool in S:\Local Sites\test\app\public\wp-content\plugins\gp-premium\hooks\functions\functions.php on line 450
That line reads:
if ( 'true' == $generate_hooks['updated'] ) {
So I’m guessing the fix might be to change it to something like:
if ( isset($generate_hooks['updated']) && 'true' == $generate_hooks['updated'] ) {
February 23, 2023 at 6:22 am #2543948David
StaffCustomer SupportHi there,
thanks for reporting ill get this added to our issues to be fixed.
Much appreciated!
February 23, 2023 at 6:36 am #2543961Stew
No worries, thanks David!
February 23, 2023 at 8:27 am #2544227David
StaffCustomer SupportIts on our list now.
Thanks again!!February 23, 2023 at 10:20 am #2544363Tom
Lead DeveloperLead DeveloperJust a heads up – not sure how you’re activating the modules, but the Hook module has been deprecated for a few years now. No need to have it activated at all.
February 23, 2023 at 4:53 pm #2544695Stew
Ah, thanks Tom. I was indeed using some instructions you wrote a few years back (and added a couple of options): https://generatepress.com/forums/topic/how-to-activate-addons-with-the-wp-cli/#post-305962
wp option update generate_package_backgrounds 'activated' wp option update generate_package_blog 'activated' wp option update generate_package_colors 'activated' wp option update generate_package_copyright 'activated' wp option update generate_package_disable_elements 'activated' wp option update generate_package_elements 'activated' # wp option update generate_package_hooks 'activated' wp option update generate_package_import_export 'activated' wp option update generate_package_menu_plus 'activated' wp option update generate_package_page_header 'activated' wp option update generate_package_secondary_nav 'activated' wp option update generate_package_sections 'activated' wp option update generate_package_site_library 'activated' wp option update generate_package_spacing 'activated' wp option update generate_package_typography 'activated'
Commenting-out the hooks option as I have above stops that warning from appearing, thanks.
On the topic of activation, I’m also using the following to set the license keys, but I still need to click a button to actually activate them — is there a better/automatic way of setting/activating?
// GeneratePress Premium add_filter('pre_option_gen_premium_license_key', fn ($pre) => 'xxxxx'); // GenerateBlocks Pro update_option('generateblocks_pro_licensing', [ 'key' => 'xxxxx' ]);
From memory I think I found these either via the forum or trawling through the plugin code and coming up with my own hacky guess.
February 24, 2023 at 8:46 pm #2546103Tom
Lead DeveloperLead DeveloperI would say this is the most recent:
wp option update generate_package_backgrounds 'activated' wp option update generate_package_blog 'activated' wp option update generate_package_copyright 'activated' wp option update generate_package_disable_elements 'activated' wp option update generate_package_elements 'activated' wp option update generate_package_menu_plus 'activated' wp option update generate_package_secondary_nav 'activated' wp option update generate_package_site_library 'activated' wp option update generate_package_spacing 'activated'
You can add your license key to the database like that, but you’ll likely hit an “Unauthorized” error when trying to update. To fix that, you’ll need to do this: https://docs.generatepress.com/article/authorizing-site-urls/
February 25, 2023 at 12:50 am #2546242Stew
Thanks for that info Tom.
Re setting the license key for Generate Blocks, the License Key field is populated on the Settings page (/wp-admin/admin.php?page=generateblocks-settings) however I still have to manually click “Save”, as I couldn’t work out a scriptable way to automate this.
February 26, 2023 at 8:24 pm #2548034Tom
Lead DeveloperLead DeveloperBasically you need to do this:
wp_remote_post( 'https://generateblocks.com', array( 'timeout' => 15, 'sslverify' => false, 'body' => array( 'edd_action' => 'activate_license', 'license' => 'YOUR LICENSE KEY', 'item_name' => rawurlencode( 'GenerateBlocks Pro' ), 'url' => home_url(), ), ) );
Hope this helps!
February 26, 2023 at 9:34 pm #2548068Stew
You’re a gentleman and a scholar Tom, that is a great idea, thank you!
February 27, 2023 at 5:52 pm #2549376Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.