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.

One Day subscribtion without using Levels

Home Forums Community Forum One Day subscribtion without using Levels

This topic contains 7 replies, has 2 voices. Last updated by  Eduan 3 years, 10 months ago.

Topic Author Topic
Posted: Wednesday Feb 20th, 2013 at 10:17 am #42587
Eric
Username: racinghorse

How can I sell a 1 day access to a category without using Levels?

I currently have 3 levels running now, Level #0, Level #1 and Level #2

I want to be able to sell an additional category were the registered buyer will only have access to the specific category purchased but not have access to Level #1 and Level #2.

Please help.

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Wednesday Feb 20th, 2013 at 4:46 pm #42609
Eduan
Username: Eduan
Moderator

Hello Eric,

Hmm… I’m afraid this is not possible using levels. I know what you require though.

You are looking for ccaps (short for custom capabilities), which are independent from each other, having access to one doesn’t give you access to the rest. However currently it’s not possible (through the UI) to restrict categories to ccaps.

However, if my memory serves me correctly, Jason provides a hack to protect categories to ccaps, or gives you tips on how to achieve it or something. You would have to check the video on ccaps to make sure:
Video » s2Member (Custom Capabilities)

– Eduan

Posted: Wednesday Feb 20th, 2013 at 4:59 pm #42613
Eric
Username: racinghorse

Hello Eduan,

Thank you for replying. I have tried the custom capabilites and it seems that would fix my issue. Although when I altered the functions.php it broke my site.

Here is what I tried.

add_action ("template_redirect", "my_custom_capabilities");

function my_custom_capabilities ()

	{

	if(is_category ("oranges") && !current_user_can ("access_s2member_level1"))
	{
		header ("Location: ". S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
	exit ();

}

Any ideas?

Posted: Wednesday Feb 20th, 2013 at 9:34 pm #42626
Eduan
Username: Eduan
Moderator

What error message did you get?

Could you try this code instead?:

add_action('template_redirect', 'my_custom_capabilities');
function my_custom_capabilities() {
	if(is_category('oranges') && !current_user_can('access_s2member_level1')) {
		header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
		exit();
	}
}

The code you provided was all messed up in several ways, I fixed it, so try this instead. ;)

– Eduan

Posted: Thursday Feb 21st, 2013 at 6:31 pm #42768
Eric
Username: racinghorse

Thank you very much,

I will give it a try and will let you know.

Posted: Thursday Feb 21st, 2013 at 6:41 pm #42769
Eric
Username: racinghorse

wow, looking good so far, no errors. Thanks a lot.

Posted: Thursday Feb 21st, 2013 at 6:57 pm #42770
Eric
Username: racinghorse

Ok so after some testing, It seems that code will give anyone access to that category where a member is at level1 no matter what custom capabilities they are in. Am I correct or did I miss something? Or do I need to input another code that ties them specifically to that custom capability?

I need them to only have the access to that specific capabililty, while using the level one payment button. I really appreciate your help. I am only a novice when it comes to code but I am trying.

Posted: Friday Feb 22nd, 2013 at 5:56 pm #42864
Eduan
Username: Eduan
Moderator

The reason for this (I think) is because this only checks if the user is NOT a level 1 user and if the category is ‘oranges’.

You would need to modify these conditionals in order to match your needs. :)

Viewing 7 replies - 1 through 7 (of 7 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.