Display CCAP level on a page

Hi, I am building a page to include in an email - users will click and the page will display a message about their membership level and then they will pick a button to click on to fill out a form related to their membership.

I am struggling to find the right code to read their CCAP and display a message based upon the CCAP. From all of my reading I thought the below was my best option but it doesn’t display anything. What am I missing?

[s2If current_user_can(access_s2member_ccap_Project_Free)] You have a Free Project Membership. [/s2If]

[s2If current_user_can(access_s2member_ccap_Project_Silver)] You have a Silver Project Membership. [/s2If]

[s2If current_user_can(access_s2member_ccap_Project_Gold)] You have a Gold Project Membership. [/s2If]

Hi Mark.

Yes, those conditionals look okay. https://s2member.com/kb-article/s2if-simple-shortcode-conditionals/

Are those actually ccaps or the names you gave to your s2Member Levels? Just checking.

Also, the cap name is case sensitive, so make sure it matches.

:slight_smile:

Hi Cristian - those are the name I gave m ccap and the problem was just as you noted. I had mixed case in the conditionals and it was causing the conditional to not work. Thank You.

I want to ask another ?
I have a page that is using ccap to determine if someone is able to use Gravity Views to pull & review data. This works perfect. The data is more extensive than I can display in the view, so there is a single field in each row a use can click on that opens a new page to display the full data for that record. When this happens I get an error from from S2 on the page saying “You are not allowed to view this content”

The page I access from is
https://mydoanin.com/data_page/

The page being served up with the full record is below - this is the one that gets the error
https://mydoanin.com/data_page/entry/41,36/

I don’t use the the ccap in the page side panel because I want to display an error message to the user. I control access to the original page is via a ccap conditional below -no issues, this works
[s2If current_user_can(access_s2member_ccap_govt_gold)]
[gravityview id=’####’]
[else]
Display an error message
[/s2If]

The entry/41,36/ is not a page in WP, the plugin is creating this to display the full record.

Any ideas to allow access to the dynamically created page above and not have the ccap being checked?

This error even happens when I access the page as an Admin and click the link to open the record.

Great! :smiley:

s2Member doesn’t give that message, it just redirects you to the page you set for Membership Options. Is that redirection happening? It’d also include some variables in the URL, that say what restriction applied and what access was needed, etc. WP Admin > s2Member > General Options > Membership Options Page

This doesn’t seem to be what’s happening, so maybe something else is not showing that data. Also that URL doesn’t look like a normal WP one. Maybe the plugin that generates that is giving that message for some reason?

Let me know. :slight_smile:

Thanks Cristian, I forgot S2 redirects to x page and doesn’t show that error message. Thanks for the reminder.

1 Like

No problem. :slight_smile:

Let me know if you need help again.