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.

Custom Capabilities by Category

Home Forums Community Forum Custom Capabilities by Category

This topic contains 4 replies, has 3 voices. Last updated by  Cristián Lávaque 3 years, 7 months ago.

Topic Author Topic
Posted: Wednesday Jun 5th, 2013 at 2:51 am #51394

I have a problem that I’m having trouble solving. My site is for salespeople from multiple difference companies who are all selling the same product. Let’s call it Product A. There are two basic membership levels, Insights and Compete. My site is a source of competitive information and a place to discuss wins, losses, and sales tactics.

Everyone that becomes a member gets access to posts categorized as Insights. When they upgrade to be a “Compete” member I need to finely control their access. Compete is a category, and related to it are 5 categories for 5 specific competitors. When you become a Compete level member, you should be given access to all of those 5 competitor categories, EXCEPT if your company also sells those competitive products.

So, you are an Insights level site member because you sell Product A like the rest of the members. Now you upgrade to a Compete membership. If you sell no competitive products, you get access to posts categorized under Competitor 1, Competitor 2, Competitor 3, Competitor 4, and Competitor 5…basically everything at the compete level.

If you sell Product A and Competitor 2, when you become a Compete level member you will be granted access to content on the other four competitor products, but will be blocked from seeing posts in category “Competitor 2”.

I think custom capabilities can handle this for me. My Insights level membership is s2member level 1, my Compete level membership is s2member level 2. Basic membership rules should apply regarding your access and expiry date for being a level 2 member, but while you are a level 2 member I need to block individual users from specific categories.

I don’t get into any custom programming, but think I need to learn or find the code for managing this custom capability.

Suggestions?

Thanks,
Jason

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Thursday Jun 6th, 2013 at 8:20 am #51487
Bruce
Username: Bruce
Staff Member

Thank you for your inquiry.

It sounds like the use of Custom Capabilities is what is necessary here. However Custom Capabilities are not able to protect entire Categories. You’ll have to protect each one of these with the correct Custom Capability when they are created, or use s2Member’s PHP Conditionals to achieve this.

Past that, you should be able to give access to “Compete” members to appropriate categories this way.

Posted: Thursday Jun 6th, 2013 at 10:56 pm #51554
Posted: Friday Jun 7th, 2013 at 12:02 am #51564

Bruce – You say that “Custom Capabilities are not able to protect entire Categories.” Can you help me understand what you mean by that. I watched the Custom Capabilities videos and it sounds like it will protect a category as I need.

To explain a little further. All Insights level entries are posted with the Insights category. I then require s2member level 1 or higher to view that category.

Compete level entries will have two categories, “Compete” and the name of the competitors, say “Oracle”. I require s2member level 2 or higher to view the Compete category, then want to use custom capabilities to block only certain site members from seeing “Oracle”.

My desired behavior is that when they are active at s2member level 2 they can see all content flagged with the Compete category except posts that are also in the Oracle category. When their s2member level 2 membership expires, they get blocked from everything with the Compete category, and the custom capabilities become irrelevant since the “Compete” tag was also on every one of those posts.

This is new to me, so I’m hoping someone provide guidance, or the lines of code

OPTION A – block categories for specific site members
If the current user is s2member level 2 AND has custom capability Oracle, then prevent them from seeing items in the Oracle category.

OTION B – instead of blocking one competitor category, grant access to all of the others
Maybe I need to have “Oracle” and all of the other competitor categories available to s2member level 3. If someone sells none of the competitive products, I just give them access to level 3 and they can see all of them. If they sell one or more of them of the competitor products, I give them access to level 2, then use custom capabilities to grant them access to the competitor categories for products they don’t sell.

I understand the concept of how I want it to work….just have no idea how to put together the code that I need to add into wordpress, so I’m looking for a sample code snippet that either grants access to, or blocks access from a specific category.

Posted: Saturday Jun 8th, 2013 at 1:51 am #51653

Bruce – You say that “Custom Capabilities are not able to protect entire Categories.” Can you help me understand what you mean by that. I watched the Custom Capabilities videos and it sounds like it will protect a category as I need.

The Categories restriction works with Levels only, and the ccaps can be used on pages/posts only.

With custom code you can combine them, and I knew the ccaps video had an example, that’s why I linked to it for you. But it’s not a default feature, you have to create the customization. With your conditionals in the customization you’ll have a lot more power to control access using these.

I understand the concept of how I want it to work….just have no idea how to put together the code that I need to add into wordpress, so I’m looking for a sample code snippet that either grants access to, or blocks access from a specific category.

Well, the video has a sample code that should help, but if it’s too advanced for you, it will be best to get help from a freelancer from a site like jobs.wordpress.net, odesk.com or elance.com.

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.