PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Create User capability gives rights to all s2Member options

s2Member Plugin. A Membership plugin for WordPress®.

Create User capability gives rights to all s2Member options

Postby highfive » August 22nd, 2011, 11:52 pm

I am creating a few custom roles for my blogs. I need someone who can add new users (Editors $ Contributors), but not have rights to mess with plugins, themes etc. It is basically and Editor+ user with a few extra capabilities.

As soon as I give this role the built in wordpress create_users capability, they suddenly have access to all of the s2member options. Ack! Certainly creating users is going to be tied somewhat to s2member, but that's a little over kill.

Also, another issue this is exposing is that I need to add users who aren't 's2Member' users. Just regular old Author's, etc. However, s2Member has hijacked the add user functionality and assumes every user I want to add is going to be an s2Member user.
User avatar
highfive
Registered User
Registered User
 
Posts: 14
Joined: August 8, 2011

Re: Create User capability gives rights to all s2Member opti

Postby Jason Caldwell » August 23rd, 2011, 8:08 pm

Thanks for the excellent questions.
highfive wrote:I am creating a few custom roles for my blogs. I need someone who can add new users (Editors $ Contributors), but not have rights to mess with plugins, themes etc. It is basically and Editor+ user with a few extra capabilities.

As soon as I give this role the built in wordpress create_users capability, they suddenly have access to all of the s2member options. Ack! Certainly creating users is going to be tied somewhat to s2member, but that's a little over kill.

Also, another issue this is exposing is that I need to add users who aren't 's2Member' users. Just regular old Author's, etc. However, s2Member has hijacked the add user functionality and assumes every user I want to add is going to be an s2Member user.

Your first question about the create_users Capability. Yes, s2Member's administrative menu is designed to run based on this Capability that is normally associated with Administrators of the site. However, s2Member does make it possible to fine tune this behavior if you like. You can do this through the application of Filters for WordPress. For instance, if you don't want to show the s2Member menu panels to certain Roles, you might do something like this:

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action ("init", "disable_s2_menu", 1);
function disable_s2_menu ()
   {
      if (current_user_is ("contributor"))
         add_filter ("ws_plugin__s2member_during_add_admin_options_create_menu_items", "__return_false");
   }
?>
* If you run a search against s2Member's source code for: ws_plugin__s2member_during_add_admin_options_create_menu_items, you will find that you can also Filter out only certain aspects of s2Member menu as well, using a similar approach ( i.e. there are other Filter Hooks available in the source code ).



Also, another issue this is exposing is that I need to add users who aren't 's2Member' users. Just regular old Author's, etc. However, s2Member has hijacked the add user functionality and assumes every user I want to add is going to be an s2Member user.
Hmm. Not sure what you mean by this. s2Member does add a section to the New User section of your Dashboard, but you can still choose whichever Role you prefer, including those that are part of the WordPress core. If they aren't going to be a Member, just leave all of the s2Member fields empty :-)
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Create User capability gives rights to all s2Member opti

Postby highfive » August 23rd, 2011, 9:44 pm

Ahh, the filters should work great and I can just set them up in the same place I handle my custom roles. Thank you.

If I were the one administering the site, it would be fine to just ignore the s2member fields during signup. This doesn't work so great for the end user admin for whom I have to keep everything as simple as possible and hide every and anything that they don't need to know about. The admin in charge of the blog doesn't know anything about s2member etc. Anyway, I'll see what I can do. I've just been going in after the fact and changing things they don't like with jQuery on the client side rather than mess with the source code.
User avatar
highfive
Registered User
Registered User
 
Posts: 14
Joined: August 8, 2011

Re: Create User capability gives rights to all s2Member opti

Postby highfive » August 24th, 2011, 5:18 pm

I added that code as specified to my my s2-hacks.php and it doesn't change anything. I even tried it without the if and the s2Member menu options are still there.

EDIT: nevermind.

EDIT2: nevermind again. It doesn't work. Once my role is defined to have create_users, the code in s2-hacks.php doesn't seem to do anything.
User avatar
highfive
Registered User
Registered User
 
Posts: 14
Joined: August 8, 2011

Re: Create User capability gives rights to all s2Member opti

Postby Jason Caldwell » August 27th, 2011, 2:52 pm

Try changing the Hook from admin_init to just init, like this:
Code: Select all
    <?php
    add_action 
("init", "disable_s2_menu", 1);
    function disable_s2_menu ()
       {
          if (current_user_is ("contributor"))
             add_filter ("ws_plugin__s2member_during_add_admin_options_create_menu_items", "__return_false");
       }
    ?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Create User capability gives rights to all s2Member opti

Postby highfive » August 29th, 2011, 10:21 pm

That worked better. It hides it for everyone now, but it is hiding it. I'll have to make sure my conditional is narrow enough since the problem in probably in my if conditional.

Thanks
User avatar
highfive
Registered User
Registered User
 
Posts: 14
Joined: August 8, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron