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™

Custom Capabilities not working?

s2Member Plugin. A Membership plugin for WordPress®.

Custom Capabilities not working?

Postby kiwis » September 17th, 2011, 11:11 am

Not sure if anyone has encountered this... and it only happened very recently so I'm sure I broke it but I can't seem to find where. Maybe there's another plug-in causing it but I've checked the known conflicts and still can't find anything. Please help and thank you in advance!

Problem:
All of the custom capabilities on the site is all of a sudden broken/not firing.

Symptoms:
Standard capabilities check is still working. ie.
Code: Select all
<?php if (current_user_can("access_s2member_level1")){ ?>
if level 1... stuff...
<?php } ?>


Any of the custom capabilities are not working i.e. I have a user set up with level 1 and custom capabilities 10white. with the code below:
Code: Select all
<?php if (current_user_can("access_s2member_level1")){ ?>
<?php if (current_user_can("access_s2member_ccap_10white")){ ?>
user can access 10 white labels.. display some stuff.
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_01red")){ ?>
user can access 1 red labels.. display some stuff.
<?php } ?>
<?php } else { ?>
No access to page at all
<?php } ?>


When the user loads the page this is what shows:
Code: Select all
user can access 10 white labels.. display some stuff.
user can access 1 red labels.. display some stuff.


So basically the check for s2Member level 1 passes.. but somehow both capabilities are returning true. I've even just done a simple return statement to check this and yes, both IF statements are returning true. I've checked that the test user is only set up with CC 10white. In fact, if I remove all of the user's CC, the page returns the same thing.

What could possibly be wrong? Any hints/thoughts would be great! Thanks!
User avatar
kiwis
Registered User
Registered User
 
Posts: 2
Joined: September 17, 2011

Re: Custom Capabilities not working?

Postby kiwis » September 17th, 2011, 12:25 pm

OK. Now I feel REALLY retarded.
I answered my own question.

As it turns out Admin users have access to view everything on the page regardless of custom restrictions. >.< doh!
User avatar
kiwis
Registered User
Registered User
 
Posts: 2
Joined: September 17, 2011

Re: Custom Capabilities not working?

Postby Cristián Lávaque » September 26th, 2011, 1:47 am

No problem, it's happened to others too. :)

Let us know if you have more questions.
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: No registered users and 1 guest

cron