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™

add administrative custom capability

s2Member Plugin. A Membership plugin for WordPress®.

add administrative custom capability

Postby halifaxious » September 7th, 2011, 2:46 pm

Hi,

I've set up a site for our club. We're using s2member to collect club dues, so the fees are not specifically for website access though that is one of the benefits of club membership. What this means though, is that a few club members need to have limited administrative access to the website. For example our Membership Co-ordinator needs to have read/write access to the Users section.

I have s2member set to block access to wp-admin. I had thought to override that with custom capabilities. I tried:

Code: Select all
add_action("template_redirect", "ASH_s2ccap",11);
function ASH_s2ccap() {
   if(is_admin() && !current_user_can("access_s2member_ccap_admin")){
      header("Location: ". S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit();
   }
}


in my theme's functions.php file but it had no effect. I have a feeling I need to do something more like:

Code: Select all
function ASH_s2ccap() {
   if(is_admin() && current_user_can("access_s2member_ccap_admin")){
      //prevent usual forward from happening
   }
}



How can I allow selective access to the Dashboard and make the Admin Bar visible for certain users while still leaving "Member Profile Modifications"=yes?

Thanks,
Jen
User avatar
halifaxious
Registered User
Registered User
 
Posts: 11
Joined: May 13, 2011

Re: add administrative custom capability

Postby Cristián Lávaque » September 8th, 2011, 2:01 am

Hi Jen.

Your approach may work, I had not thought about it. You could also try giving those special members a higher level than the others and edit the capabilities that role has.

https://codex.wordpress.org/Roles_and_C ... pabilities
https://wordpress.org/extend/plugins/user-role-editor/
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


Return to s2Member Plugin

Who is online

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

cron