Community Support Forums — WordPress® ( Users Helping Users ) — 2011-08-30T16:41:36-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14719 2011-08-30T16:41:36-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33395#p33395 <![CDATA[Re: Custom Capabilities]]>

Statistics: Posted by Cristián Lávaque — August 30th, 2011, 4:41 pm


]]>
2011-08-29T22:59:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33320#p33320 <![CDATA[Re: Custom Capabilities]]>

THANKS!

Daisy

Statistics: Posted by peeld — August 29th, 2011, 10:59 pm


]]>
2011-08-29T17:52:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33292#p33292 <![CDATA[Re: Custom Capabilities]]>

I look forward to your results, I hope the code works the way you want it. :)

Statistics: Posted by Cristián Lávaque — August 29th, 2011, 5:52 pm


]]>
2011-08-29T16:29:36-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33273#p33273 <![CDATA[Re: Custom Capabilities]]>
I must say, just browsing through this forum, the support is EXCELLENT, and I've loved watching you populate the list of help requests all morning with your responses. I'm super happy with S2Member and my site isn't even LIVE yet... I think it's a testament to the product that most of the help requests are regarding *extending* the product rather than basic functionality. THANKS!!!

Daisy

Statistics: Posted by peeld — August 29th, 2011, 4:29 pm


]]>
2011-08-29T16:26:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33272#p33272 <![CDATA[Re: Custom Capabilities]]>
About your code, your user should have access if he has either one of the ccaps, right? Then using the OR is the problem, because one of those ccaps missing will cause the redirection. You should use AND so that happens only if both ccaps are missing.

Try this version:

Code:
if (bp_is_groups_component() && bp_current_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworking') && !current_user_can('access_s2member_ccap_goalsettingauditing')) {
    header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
    exit;
}
 


I hope that helps. :)

Statistics: Posted by Cristián Lávaque — August 29th, 2011, 4:26 pm


]]>
2011-08-29T14:04:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33252#p33252 <![CDATA[Re: Custom Capabilities]]>
Code:
       if (( bp_is_groups_component() && 'goal-setting-and-mental-management' == bp_current_item() && !current_user_can('access_s2member_ccap_goalsettingworking')) || (bp_is_groups_component() && 'goal-setting-and-mental-management' == bp_current_item() && !current_user_can('access_s2member_ccap_goalsettingauditing')))
     {
           header ('Location: '. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
            exit ();
      }


I added in a ')' in a couple places because I think your code snippet was missing them?

Statistics: Posted by peeld — August 29th, 2011, 2:04 pm


]]>
2011-08-29T13:43:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33250#p33250 <![CDATA[Re: Custom Capabilities]]>

In my opinion, if you already have the tags in place, you know there are restrictions being used, so no need to have another tag that to say it's restricted. This would probably be a shorter version of your code:

Code:
if ((has_tag('music') && !current_user_can('access_s2member_ccap_music')) || (has_tag('jazz') && !current_user_can('access_s2member_ccap_jazz'))) {
        header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
        exit;
}
 

Statistics: Posted by Cristián Lávaque — August 29th, 2011, 1:43 pm


]]>
2011-08-28T12:10:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33199#p33199 <![CDATA[Re: Custom Capabilities]]>
I can't thank you both enough for getting back to me so quickly with your informative replies! If I understand what's going on, I think that the reason you would need both is because of the way Jason formulated the code in functions.php, and not something that is fundamental to the S2Member product. I have an idea for a solution that would work great for my application:

1) Bypass the "ccaps" tagging altogether, download page tagger, and use it to tag my pages. This will allow me to see the tags in Page list view and give me the ability to apply multiple tags. (Not essential, but it sounds like it will work, so why not?)
2) Modify the PHP code which Jason suggested in his video (functions.php) to enable permissions to pages as I see fit (I am not a PHP expert, and I haven't tested the code yet, but this should give you an idea of where I'm going):

Code:
//==================================================================================
//Start out assuming the user does NOT have permissions...
$Permissions_Flag = "N";

//First, check for a simple tag of "R" which I will add to ALL pages I want to restrict, in addition to one
//or more specific tags.  If the "R" tag does not exist, by my definition I do not want to restrict this 
//page, so no need to check further...
if !has_tag("R")
    $Permissions_Flag = "Y";
//Specific permissions tests based on specific tags follow...
else if ((has_tag("music") && current_user_can("access_s2member_ccap_music"))
    $Permissions_Flag = "Y";
else if ((has_tag("jazz") && current_user_can("access_s2member_ccap_jazz"))
    $Permissions_Flag = "Y";
endif;

//If the permission checks failed to remove the restriction, user will be sent to the
// membership options page...
if $Permissions_Flag == "N" {
   header ("Location: ". S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
   exit (); }
endif;
//===============================================================================
 

To oversimplify, Jason's strategy is to assume the user has permissions until proven otherwise, whereas my strategy is to assume the user doesn't have permissions until proven otherwise. This way I can test my tags individually, verify my pessimistic assumption once at the very end of all my permission checks, and redirect if necessary. Can you think of any reason why this wouldn't work? Sorry to keep bothering you, but I'd like to make sure I have the correct strategy before applying it to all the pages on my site.

Thanks!

Lonnie

Statistics: Posted by Lonaldo — August 28th, 2011, 12:10 pm


]]>
2011-08-28T02:23:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33174#p33174 <![CDATA[Re: Custom Capabilities]]> WP Admin -> s2Member -> Restriction Options -> Tag

So let's stick to "custom capabilities" or "ccaps" to avoid misunderstandings. :)

Cassel is right, the way s2Member handles multiple ccaps in for a page/post is requiring all of them to show the page, not one or the other. If you need to require one ccap or the other in a page, instead of the meta box, you'd use conditionals in the body of the page. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals

In your case, though, you don't need to add the "music" ccap in the meta box of a page that's just for "jazz" users, you can just add the "jazz" one that'd only show it ot users with the "jazz" ccap, which would be a portion of the "music" ones. I hope that makes sense.

Statistics: Posted by Cristián Lávaque — August 28th, 2011, 2:23 am


]]>
2011-08-27T20:26:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33131#p33131 <![CDATA[Re: Custom Capabilities]]>

1) Can you use the technique you described to assign more than one tag to the same page? For example, I might want a general "Music" tag that I would use to assign the page to a deluxe membership, and another specialized tag for "Jazz" that I would assign to a less all-inclusive membership. (I realize there are other ways to accomplish this with single page tags, but this would be the most convenient for the application I have in mind).

From what i gathered from similar question, if you assign two "custom tags" to a page, it will require the user to have BOTH access. So, if you want page to be accessible through a package called "Jazz-singers", and a package called "Jazz-musicians", then, you might need to set pageA with the "tags" for jazz and singer, and the pageB with jazz and musician. However, you would have to be sure to include, in the paypal button creation, BOTH tags (either JAZZ and SINGER or JAZZ and MUSICIAN), otherwise, if you have only JAZZ, then the user will not meet both criterias for tag access. I think it is possible, but it will depend on the structure you want to set up.

Another example, i will have 2 different packages sooon and i have pages set with three tags but only one per page. I have some pages with BASIC, some pages with ELEMENT and one page with FORUM so when user buys access to package A, they get access to all the pages with BASIC, and the FORUM, and if user buys package B, i will give access to pages ELEMENTS and FORUM (yes, FORUM is part of both packages), yet each page has only one tag.


2) Does this use the same "tagging" technique as some of the other Page tagging applications, like "Page Tagger"? The reason I ask is because it would be convenient for me to see the tags on the Page List screen at a glance, rather than to have to open up every individual page to see the tag (I have many pages on my site).

If you are talking about showing the ccaps like it shows the page ID, i dont think it is done yet, but it is a darn good idea! Suggest that to Jason! I would love that too.

Hope it helps.

Statistics: Posted by cassel — August 27th, 2011, 8:26 pm


]]>
2011-08-27T20:05:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33129#p33129 <![CDATA[Re: Custom Capabilities]]>
Thank you both for getting back to me so quickly! This should work out great. If you don't mind, I'd like to ask a couple of follow-up questions:

1) Can you use the technique you described to assign more than one tag to the same page? For example, I might want a general "Music" tag that I would use to assign the page to a deluxe membership, and another specialized tag for "Jazz" that I would assign to a less all-inclusive membership. (I realize there are other ways to accomplish this with single page tags, but this would be the most convenient for the application I have in mind).

2) Does this use the same "tagging" technique as some of the other Page tagging applications, like "Page Tagger"? The reason I ask is because it would be convenient for me to see the tags on the Page List screen at a glance, rather than to have to open up every individual page to see the tag (I have many pages on my site).

Thanks Again!

Lonnie

Statistics: Posted by Lonaldo — August 27th, 2011, 8:05 pm


]]>
2011-08-27T02:23:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=33049#p33049 <![CDATA[Re: Custom Capabilities]]>
The meta box in the edit page is probably what you want to use, as Cassel suggested. :)

Statistics: Posted by Cristián Lávaque — August 27th, 2011, 2:23 am


]]>
2011-08-26T22:25:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=32991#p32991 <![CDATA[Re: Custom Capabilities]]>
So, if you want a category of pages about Music, you can enter Music in the Custom Capabilities field, so when you create the conditional code, you will then be able to use it to give access only to those pages to certain people.

I am sure Cristian will come with the link to the correct video but i remember that this top right box was not mentioned in the video! Hope it helps.

Statistics: Posted by cassel — August 26th, 2011, 10:25 pm


]]>
2011-08-26T17:55:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14719&p=32973#p32973 <![CDATA[Custom Capabilities]]>
I LOVE the idea of custom capabilities, and I get the concept of the required PHP code entirely. However, I am relatively new to Wordpress, and don't know how to provide either tags or categories to pages (I can see how to add them to posts, but not pages). Is there an easy way to do this, or is there a plugin you would recommend? Thanks!

Lonnie

Statistics: Posted by Lonaldo — August 26th, 2011, 5:55 pm


]]>