Whenever I upgrade all capabilites are reset

Hi,

Whenever I upgrade s2member core or the pro add-on, all of my capabilities for s2member Level 1 and S2member Level 2 are reset. I have had this plugin for a while, and since I have had it every time I do an update I loose all capabilities. I need to go into capabilities manager, and add in all of the custom capabilities for s2Member Level 1 and 2. Is there a way to fix this?

Thanks,

Aaron

What capabilities plugin are you using? I use Capabilities Manager Enhanced and have never had this issue on any site.

yes I’m using Capabilities Manager Enhanced, and this happens every time. So before an upgrade I take a screenshot of the CME settings for each role, then I upgrade S2Member then I go back and add the capabilities in again. I’m trying to figure out why the plugin is resetting all the capabilities, right now it is adding in an extra step to the upgrade process.

Thanks,

Aaron

I wish I had an easy answer for you, but I’m going to have to give you the old “test in a clean WordPress installation” to search for plugin/theme conflicts. Of course, you’ll need to leave s2Member and the Enhanced Capabilities Manager running for the test to be at all useful. I’d suggest cloning the site to a dev site and testing from there as well. Good luck.

You need to create an mu-plugin to prevent capabilities being reset when you update s2Member. To do this, paste the following code into a blank text file :

<?php
/* Prevent s2Member re-assigning custom capabilities on re-activation */    
function remove_all_s2_css() {
	wp_dequeue_style( 'ws-plugin--s2member' );
}
add_filter( 'ws_plugin__s2member_lock_roles_caps', '__return_true' );
add_action( 'ws_plugin__s2member_during_add_css', 'remove_all_s2_css' );

DON’T use a wordprocessor for this, but use something like Notepad, Geany, or Notepad++. Call the file s2-prevent-change-capabilities.php and upload it by FTP or the cPanel File Manager to your mu-plugins folder.

1 Like

Thanks, It seems to be working. I uploaded an older version, then upgraded and it worked on my dev site.

Thanks,

Aaron