Page 1 of 1

User role capabilities cleared at update

PostPosted: July 20th, 2011, 10:29 am
by uabclst
Hi,

I've been using s2member for a while (now upgraded to Pro) and one thing that bothers me is that the user roles s2member_level0, s2member_level1... etc get their capabilities reset every time I update the plugin (or when adding Pro).

I have different capabilities for different roles for my clients that get access to the wp admin view. Each time I update, all capabilities are reset to "read". Then I get complaints from my clients who suddenly can't access the wp editor.

Is it really necessary to clear role capabilities at the updates?

Thanks

Re: User role capabilities cleared at update

PostPosted: July 20th, 2011, 7:59 pm
by Cristián Lávaque
Oh, I'm guessing you haven't enabled the Deactivation Safeguars, it's at the very top of the General Options panel. WP Admin -> s2Member -> General Options -> Deactivation Safeguards

Turn that on and your s2Member settings will still be there after the updates.

I hope that helps. :)

Re: User role capabilities cleared at update

PostPosted: July 20th, 2011, 10:58 pm
by doctorproctor
Curious if this works for others...just noticed the same on my site, and deactivation safeguards were set to yes...

Jim

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 12:46 am
by Cristián Lávaque
Are you positive it was set to yes? Were your s2Member settings reset? From what to what version did you upgrade s2Member?

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 1:37 am
by uabclst
Mine was set to yes too ( Yes, safeguard all data /options).

I have noticed it at several updates. My last was to Version 110710 (don't remember from which version, but i tend to update regularly so it was probably from the previous version).
Then again when I upgraded to s2Member Pro v110710 it happened again.

I use the "User Role Editor 3.1.1" to set the role capabilities.

Thanks

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 1:48 am
by Cristián Lávaque
Thanks. I'll let Jason know in case it's a bug.

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 1:51 am
by Cristián Lávaque
Could you list the other plugins you're using? Have you tried an update with the other plugins deactivated to see if you lose the s2Member settings then too?

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 7:00 pm
by Jason Caldwell
Thanks for the heads up on this thread.

Yea, this is something new that was introduced in the latest versions of s2Member. Now that s2Member supports an unlimited number of Levels ( with s2Member Pro installed ), it's important for s2Member to reconfigure it's Roles/Capabilities each time it's reactivated, for various reasons. However, we do understand that in some situations this is not desirable ( particularly when/if you've made custom modifications to your Roles/Capabilities ).

To prevent this from happening to your client, please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter
("ws_plugin__s2member_lock_roles_caps", "__return_true");
?>
* Add this file after s2Member is installed/activated.

Re: User role capabilities cleared at update

PostPosted: July 21st, 2011, 7:10 pm
by doctorproctor
Thanks, Jason! Added this to my existing s2hacks.php, which shouldn't affect the existing code (re. remove_action ["add_meta_boxes"...]).

Jim

Re: User role capabilities cleared at update

PostPosted: July 22nd, 2011, 3:34 am
by uabclst
Thanks, I'll try this.