Hi @webdevatunc
I hope you are doing well today.
I pinged our Beehive to see if we can replicate this issue and see what is the reason behind it. We will post an update here as soon as more information is available.
Kind Regards,
Kris
Hi @webdevatunc
Sorry for the delay here,
Our developer confirmed
This issue occurs due to the plugin’s internal activation hook. Specifically, in the main plugin file (google-analytics-async.php, line 58), the following line registers an activation hook:
register_activation_hook( __FILE__, array(
\Beehive\Core\Controllers\Installer::instance(), 'activate'
) );
When Composer updates the plugin, WordPress treats it as a deactivation followed by reactivation. This triggers the activate() method in core/controllers/class-installer.php (line 37), which then calls assign_caps() on line 48. That method resets the role capabilities—assigning default values and ignoring any custom permission settings you had in place.
The assign_caps() method (line 155 of the same file) only adds a predefined set of capabilities to the administrator role. Unfortunately, it does not retain or merge any custom configurations you’ve made.
You can preserve your custom settings by adding a Composer script to back up and restore permissions around the update process. Add the following to your composer.json:
{
"scripts": {
"pre-update-cmd": [
"wp option get beehive_settings > /tmp/beehive_backup.json"
],
"post-update-cmd": [
"wp option set beehive_settings --format=json < /tmp/beehive_backup.json"
]
}
}
This approach saves your current permissions just before the update, and restores them immediately after.
Please, test it on a staging site first.
Best Regards
Patrick Freitas
Hi @webdevatunc,
Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open this thread if you need any further assistance.
Kind Regards,
Nithin