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™

Dev'l Question: Does S2member check for role or capbility?

s2Member Plugin. A Membership plugin for WordPress®.

Dev'l Question: Does S2member check for role or capbility?

Postby dwdutch » June 21st, 2011, 10:13 pm

I have users assigned to the S2member Level 2 role and I have Custom Registration Fields that are restricted to users with this role.

In addition I have a special capability for which i want a handful of my S2member Level 2 users to have access. Since the majority with that role will NOT have access to the new capability, I left the s2member Level 2 role untouched and I created a new role (called Board Member) to which I assigned my one additional special capability PLUS all of the same capabilities as the s2member Level 2 role (i.e. ACCESS_S2MEMBER_LEVEL0, ACCESS_S2MEMBER_LEVEL1 and ACCESS_S2MEMBER_LEVEL2).

HOWEVER, I noticed that those assigned the new role (i.e. Board Member) cannot complete changes in their USER PROFILE for the Custom Registration Fields. The fields are visible in the USER PROFILE but when the user changes the field then submits the page, the field changes are NOT saved.

So, my questions...

To accept User Profile changes, does S2member rely on checking the ROLE of the user -or- on checking the ACCESS_S2MEMBER_LEVEL2 capability?

Is there a work-around to allow a new role that includes the ACCESS_S2MEMBER_LEVEL2 capability to still complete changes in the Custom Registration Fields of the USER PROFILE?

I have S2member Version: 110620 and WP 3.1.3
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

Re: Dev'l Question: Does S2member check for role or capbilit

Postby Cristián Lávaque » June 22nd, 2011, 12:59 am

Well, I don't know how the custom field check is done, whether role or capability, but I can suggest that instead of giving that handful of users another role, you just edit their profiles to add the new custom capability. You can do it by hand in their profiles or in bulk using the Import tool if you have s2Member Pro.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Dev'l Question: Does S2member check for role or capbilit

Postby dwdutch » June 22nd, 2011, 8:53 pm

Thanks for he suggestions; however, I think it is appropriate to define a new ROLE in this case. To simplify this support-question, I described ONE new capability - in actuality, I have a handful of users who will support GRAVITY FORMS within my blog. That particular plug-in introduces 18 additional capabilities! I want to give this power to our board-members as they rotate in/out of various positions and I want our non-technical admin to be able to manage this assignment. For that reason, it is much easier if she only has to change the role assignment.
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

Re: Dev'l Question: Does S2member check for role or capbilit

Postby Jason Caldwell » June 25th, 2011, 1:27 am

Thanks for the excellent question.
I can't say that this configuration is going to work fully as expected in all aspects of s2Member, because s2Member DOES expect all "Members" to have one of the s2Member Roles, and/or the Subscriber Role. But in the specific scenario that you pointed out, you could try this hack to get things working.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action
("ws_plugin__s2member_before_custom_fields_configured_at_level", "my_function");
function my_function($vars = array()){
if(
current_user_is("board_member"))
   $vars["__refs"]["level"] = 2;
}
?>
~ 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


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron