Community Support Forums — WordPress® ( Users Helping Users ) — 2010-09-23T08:51:46-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=681 2010-09-23T08:51:46-05:00 http://www.primothemes.com/forums/viewtopic.php?t=681&p=3429#p3429 <![CDATA[Re: _ccap and advanced conditionals]]> Statistics: Posted by Elizabeth — September 23rd, 2010, 8:51 am


]]>
2010-09-10T11:44:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=681&p=3173#p3173 <![CDATA[Re: _ccap and advanced conditionals]]> Statistics: Posted by taxgeeks — September 10th, 2010, 11:44 am


]]>
2010-09-07T21:03:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=681&p=3011#p3011 <![CDATA[Re: _ccap and advanced conditionals]]> Hi there. Thanks for the great question.

Custom Capabilities are applied through a purchase. So you would enter them into the PayPal® Button Generator that is provided by s2Member. The thing that gets most people, is the difference between how they're typed into that field in the Button Generator, and how you actually test for them.

If you type them into the Button Generator provided by s2Member, you just use "trigger words":
Code:
( ex: music,videos )

But, if you're testing for them with Simple or Advanced Conditionals
( for instance, using PHP scripting ), you use the full Capability name:
Code:
if(current_user_can("access_s2member_ccap_music")) 

So once a Custom Capability is applied, s2Member always prefixes it with:
Code:
access_s2member_ccap_ ( followed by your trigger word )

Now, if you're trying to apply Custom Capabilities to a specific account, you can do that through your WP Dashboard, by going to Users, and finding a User account in the list. Click the [ Edit ] link, and that will bring up a panel where you can type in the Custom Capabilities: ( ex: music,videos ).

If you're building a custom registration form of some kind, or you would like to apply Custom Capabilities in some other creative way that s2Member does not use by default, you can use a Hook for that.

Create a file called my-s2member-hacks.php, and place that file into your /wp-content/mu-plugins/ directory. If that special directory does not exist yet, create it. So you will end up with:
/wp-content/mu-plugins/my-s2member-hacks.php ( or any file name is fine - it's not important ).

Inside that file, you would do something like this:
Code:
<?php
add_action
("ws_plugin__s2member_during_configure_user_registration_front_side", "my_function");
function my_function($vars){
    $user = $vars["__refs"]["user"];
    // print_r($vars) for a bigger picture during development.
    $user->add_cap("access_s2member_ccap_music");
    $user->add_cap("access_s2member_ccap_videos");
}
?>

So this would automatically add those two Custom Capabilities during every registration, without any regard to whether it's a free registration or not. Obviously, you could add some of your own code into the mix so that you could test for other circumstances as well. ~ there are many ways to build onto this.

Statistics: Posted by Jason Caldwell — September 7th, 2010, 9:03 pm


]]>
2010-09-05T19:42:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=681&p=2926#p2926 <![CDATA[_ccap and advanced conditionals]]>
i see in most of the examples that the code is (1) if user can access level 3, and (2) user can access _ccap.

my problem is what does the code need to be to have it include #2 (access_ccap)--other than buying a paypal button for _ccap.

p.s. i consider myself to be somewhere between beginner and intermediate in writing php code w worpdress (although this question may seem contrary to that).

Any input (and criticism) is welcome.

s2member is a great plugin!

Statistics: Posted by taxgeeks — September 5th, 2010, 7:42 pm


]]>