latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Restricting page access to one level

Home Forums Community Forum Restricting page access to one level

This topic contains 4 replies, has 4 voices. Last updated by  Raam Dev 4 years, 3 months ago.

Topic Author Topic
Posted: Wednesday Sep 26th, 2012 at 9:51 am #26567

Hello,

Is there a way to restrict page access to one particular membership level, but not the highest level? For instance if I add a new membership level that is for Employers only. I want them to have access to a page but I don’t want the other site members to have access and I also don’t want the Employers to have access to the other restricted pages that other members have access to.

Thanks,

Steve

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Wednesday Sep 26th, 2012 at 12:16 pm #26587
Eduan
Username: Eduan
Moderator

Hello Stephen,

You might be interested in using custom capabilities (ccaps for short) for this purpose. You can find a video about them here: Video » s2Member (Custom Capabilities)

Hope this helps. :)

Posted: Wednesday Sep 26th, 2012 at 12:17 pm #26588
David Welch
Username: dwbiz05

wrap the content with this shortcode:

[s2If current_user_is(s2member_level2)]
    Some premium content for Level 2 Members.
[/s2If]
[s2If !current_user_is(s2member_level2)]
    You do not have access to this page.
[/s2If]

if you use “current_user_can(access_s2member_level2)” then anyone at or above that level will see it.

The above function says they must BE at that level.

That should do it.

Dave

PS. or you could use CCaps. However, I think if you use CCaps, it will send them to the membership options page if they don’t have that CCap. (not sure) Which you may or may not want, depending on the type of site you are building.

  • This reply was modified 4 years, 3 months ago by  David Welch.
  • This reply was modified 4 years, 3 months ago by  David Welch.
  • This reply was modified 4 years, 3 months ago by  David Welch.
  • This reply was modified 4 years, 3 months ago by  David Welch.
Posted: Monday Oct 8th, 2012 at 10:29 am #27797

Thank you very much for the replies. I believe this will work but I am realizing now that I probably should consolidate the current membership levels I have. I currently have 6 different membership levels but they all provide the same access. I made 6 different levels because that is what I thought I needed to do to provide different pricing options. Now I see I can handle the pricing with Custom Capabilities. So now my question is, can I recreate my buttons so they all use one level of access and then go in to all of my current members and change their membership to the new single level I will have? Will this mess anything up? I will make this level 2 and level 1 will be the new one I need (Employers) where they will not have access to the information that regular members do, but instead a small set of pages that only they can access.

Thanks again,

Steve

Posted: Tuesday Oct 9th, 2012 at 3:30 am #27854
Raam Dev
Username: Raam
Staff Member

It won’t mess anything up as long as you update your content restrictions to reflect the new way you’re using levels. Changing a users level only affects the content they can see, so you just need to make sure the restrictions are correct.

I recommend testing this with one account first and then switching all your live users.

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.