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.

About: Suzan Romanov

Very notice programmer, but I'm getting there. Love working out, going out for drinks, and just enjoying life...

Thanks for any help!

*kisses.


Topics I'm Subscribed To

Viewing 2 topics - 1 through 2 (of 2 total)
Topic Count Last Reply
One Last Try (Custom Capabilities Question)

By:  Suzan Romanov in: Community Forum

voices: 1
replies: 0

3 years, 10 months ago  Suzan Romanov

add_action error: help – pretty please!

By:  Suzan Romanov in: Community Forum

voices: 3
replies: 8

3 years, 10 months ago  Suzan Romanov

Viewing 2 topics - 1 through 2 (of 2 total)

Topics I've Started

Viewing 2 topics - 1 through 2 (of 2 total)
Topic Count Last Reply
One Last Try (Custom Capabilities Question)

By:  Suzan Romanov in: Community Forum

voices: 1
replies: 0

3 years, 10 months ago  Suzan Romanov

add_action error: help – pretty please!

By:  Suzan Romanov in: Community Forum

voices: 3
replies: 8

3 years, 10 months ago  Suzan Romanov

Viewing 2 topics - 1 through 2 (of 2 total)

My Latest Replies (From Various Topics)

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Friday Feb 22nd, 2013 at 12:08 pm #42851

Hey, I just posted this, but noticed I didn’t wrap the code lines using the code button. Thanks again!

=====================================

Hey guys – thanks again for your help on this stuff.

Honestly I just can’t seem to figure out what to do to make this work.

I found this post that seems to have a similar logic.
http://www.s2member.com/forums/topic/custom-capabilities-assistance-please/

And in my previous post I cut and pasted the exact code I’m using…. pasted it below again.

I’m putting the code inside of the functions.php file inside of the wp_include folder through my ftp client.

****THE END GOAL****

I have 4 different products that customers can buy in any combination.

All I want to do is to be able to let them purchase one of the products, or two, or three, or all four.

If not getting all four, they should have the option of purchase 2 or 3 in any combination… or purchase just one.

I’ve labelled each product A, B, C, D.

So a customer can purshase A and B, or A, C, and D, or just D, or just C, and so on… I think you get the point.

Here’s my code below again…

***What Am I missing in my thinking???***

Thanks again!!!

****CODE INSIDE OF THE FUNCTIONS.PHP FILE*****

add_action (“wp”, “my_custom_capabilities”);

function my_custom_capabilities ()
{

if(has_tag(“A”) && !current_user_can (“access_s2member_ccap_A”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“B”) && !current_user_can (“access_s2member_ccap_B”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“C”) && !current_user_can (“access_s2member_ccap_C”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“D”) && !current_user_can (“access_s2member_ccap_D”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

====================================================================

Posted: Friday Feb 22nd, 2013 at 12:02 pm #42850

Hey guys – thanks again for your help on this stuff.

Honestly I just can’t seem to figure out what to do to make this work.

I found this post that seems to have a similar logic.
http://www.s2member.com/forums/topic/custom-capabilities-assistance-please/

And in my previous post I cut and pasted the exact code I’m using…. pasted it below again.

I’m putting the code inside of the functions.php file inside of the wp_include folder through my ftp client.

****THE END GOAL****

I have 4 different products that customers can buy in any combination.

All I want to do is to be able to let them purchase one of the products, or two, or three, or all four.

If not getting all four, they should have the option of purchase 2 or 3 in any combination… or purchase just one.

I’ve labelled each product A, B, C, D.

So a customer can purshase A and B, or A, C, and D, or just D, or just C, and so on… I think you get the point.

Here’s my code below again…

***What Am I missing in my thinking???***

Thanks again!!!

****CODE INSIDE OF THE FUNCTIONS.PHP FILE*****

add_action (“wp”, “my_custom_capabilities”);

function my_custom_capabilities ()
{

if(has_tag(“A”) && !current_user_can (“access_s2member_ccap_A”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“B”) && !current_user_can (“access_s2member_ccap_B”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“C”) && !current_user_can (“access_s2member_ccap_C”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“D”) && !current_user_can (“access_s2member_ccap_D”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}
====================================================================

Posted: Thursday Feb 14th, 2013 at 11:27 pm #41757

Hey Jason, and thank you Eduan. I know you’re busy guys so I appreciate the time you’ve spent on this so far.

Also, yes Eduan – I tried the trouble shooting you suggested. Tried deactivating plugins, different themes, etc… and nothing.

So Jason – I’ll be honest that I’m a bit novice, but know enough to find the files, and feel my way around.

I added the code below to the functions.php file. I located the functions.php file in the wp-includes folder through my FTP.

Just assumed it would work fine.

Here’s the code below.

Just feel like I’m missing something really BIG and obvious. Let me know what you think. I’m still trying different things, and made sure to make a backup of the functions.php file in case i really mess something up.

Thanks again guys!

P.S. Jason, whenever I take this line out from the functions.php file (add_action (“wp”, “my_custom_capabilities”);) – the fatal error goes away. but then the custom capabilities functions don’t seem to work either.

Appreciate you’re help again.

==============================================================

add_action (“wp”, “my_custom_capabilities”);

function my_custom_capabilities ()
{

if(has_tag(“A”) && !current_user_can (“access_s2member_ccap_A”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“B”) && !current_user_can (“access_s2member_ccap_B”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“C”) && !current_user_can (“access_s2member_ccap_C”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“D”) && !current_user_can (“access_s2member_ccap_D”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}
====================================================================

Posted: Tuesday Feb 12th, 2013 at 12:08 pm #41573

Also Eduan, to add to my last reply – I’m using the free version if that’s what you’re asking as well.

Thanks again.

Posted: Tuesday Feb 12th, 2013 at 10:48 am #41566

Hey Eduan – thanks soooo much for getting back on this.

Been pulling my hair out!

Ok so…

Wordpress Version: 3.5.1
S2 Member Version: Version 130203

If it’s any help, when I take this line out of the functions.php file, the site works as in no fatal error (although the custom capabilities don’t work either)
add_action (“template_redirect”, “my_custom_capabilities”);

But as soon as I add this line to the functions.php file, it gets the fatal error.

Again, replaced, the “template_redirect” part with “wp” based off another post, but same error.

I will check out the references you sent, and look out for your next reply.

Thanks again in advance for your help on this one.

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

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.