Community Support Forums — WordPress® ( Users Helping Users ) — 2011-11-12T02:13:21-05:00 http://www.primothemes.com/forums/feed.php?f=36&t=1405 2011-11-12T02:13:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=52842#p52842 <![CDATA[Re: Buddypress group as custom capability?]]> http://jobs.wordpress.net

I hope that helps. :)

Statistics: Posted by Cristián Lávaque — November 12th, 2011, 2:13 am


]]>
2011-11-08T12:02:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=52549#p52549 <![CDATA[Re: Buddypress group as custom capability?]]>
:cry:

Statistics: Posted by peeld — November 8th, 2011, 12:02 pm


]]>
2011-11-06T21:02:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=52409#p52409 <![CDATA[Re: Buddypress group as custom capability?]]> I hunted around and tried the code below, as it seemed it might be a workaround, but it doesn't work either:

Code:
/**s2member code */

add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
    {
        if (fnmatch ("/classes/goal-setting-and-mental-management*", $_SERVER["REQUEST_URI"]) && !current_user_can("access_s2member_ccap_goalsettingworkingfall2011") && !current_user_can("access_s2member_ccap_goalsettingauditingfall2011"))
            {
                header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                exit ();
            }
        else if (fnmatch ("/classes/runningcontacts-i*", $_SERVER["REQUEST_URI"]) && !current_user_can("access_s2member_ccap_runningcontactsiworkingfall2011") && !current_user_can("access_s2member_ccap_runningcontactsiauditingfall2011"))
            {
                header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                exit ();
            }
   else if (fnmatch ("/classes/agility-foundation*", $_SERVER["REQUEST_URI"]) && !current_user_can("access_s2member_ccap_foundationclassworkingfall2011") && !current_user_can("access_s2member_ccap_foundationclassauditingfall2011"))
       {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
       }
   else if (fnmatch ("/classes/hooligans*", $_SERVER["REQUEST_URI"]) && !current_user_can("access_s2member_ccap_hooligan"))
       {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
       }
    }

/**end s2member code */

Statistics: Posted by peeld — November 6th, 2011, 9:02 pm


]]>
2011-11-06T10:07:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=52375#p52375 <![CDATA[Re: Buddypress group as custom capability?]]>
Thanks,
Daisy

Statistics: Posted by peeld — November 6th, 2011, 10:07 am


]]>
2011-11-05T21:59:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=52331#p52331 <![CDATA[Re: Buddypress group as custom capability?]]>
If I were you, I'd go back to the code you had working before, post it in the BP forums telling them it used to work and now doesn't, and if they could help.

Statistics: Posted by Cristián Lávaque — November 5th, 2011, 9:59 pm


]]>
2011-11-04T18:38:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=51058#p51058 <![CDATA[Re: Buddypress group as custom capability?]]>
So, I went to my restriction options in the s2member panel, and I had a URI restriction on /classes/. When I remove THAT, the above code is clearly not working at ALL - even a not logged in user can see everything. The only thing keeping the world from seeing the classes was that I had a URI restriction set; the code above isn't working at all anymore. Seems so weird. I've got the URI restriction back in place for now.

Thanks for your continued support,

Daisy

EDIT: Do you think changing from bp group conditionals to just uri conditionals would work? Not sure how to format that but I can see where it might work?

Statistics: Posted by peeld — November 4th, 2011, 6:38 pm


]]>
2011-11-04T18:17:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=51055#p51055 <![CDATA[Re: Buddypress group as custom capability?]]> Will report back!

Statistics: Posted by peeld — November 4th, 2011, 6:17 pm


]]>
2011-11-04T00:52:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50986#p50986 <![CDATA[Re: Buddypress group as custom capability?]]>
Code:
    /** s2member code */
    add_action ("template_redirect", "my_custom_capabilities", 1);
    function my_custom_capabilities ()
       {
       if (bp_is_groups_component() && bp_is_single_item() && bp_current_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworkingfall2011') && !current_user_can('access_s2member_ccap_goalsettingauditingfall2011')) {
        header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
        exit;
    }

        else if (bp_is_groups_component() && bp_is_single_item() && bp_current_item() == 'runningcontacts-i' && !current_user_can("access_s2member_ccap_runningcontactsiworkingfall2011") && !current_user_can('access_s2member_ccap_runningcontactsiauditingfall2011'))
             {
                    header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                    exit ();
                }

       else if ( bp_is_groups_component() && bp_is_single_item() && bp_current_item() == 'agility-foundation' && !current_user_can("access_s2member_ccap_foundationclassworkingfall2011") && !current_user_can('access_s2member_ccap_foundationclassauditingfall2011'))
         {
          header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
          exit ();
           }

       else if ( bp_is_groups_component() && bp_is_single_item() && bp_current_item() == 'hooligans' &&
    !current_user_can("access_s2member_ccap_hooligan"))
        {
          header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
          exit ();
       }

       }
    /** end s2member code */
 


I hope that works.

Here's your code rewritten, just for fun, but I haven't tested it. :P

Code:
add_action('template_redirect', 'my_custom_capabilities', 1);
function my_custom_capabilities()
{
    if ((bp_is_groups_component() && bp_is_single_item()) && (
        (bp_current_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworkingfall2011') && !current_user_can('access_s2member_ccap_goalsettingauditingfall2011')) ||
        (bp_current_item() == 'runningcontacts-i' && !current_user_can('access_s2member_ccap_runningcontactsiworkingfall2011') && !current_user_can('access_s2member_ccap_runningcontactsiauditingfall2011')) ||
        (bp_current_item() == 'agility-foundation' && !current_user_can('access_s2member_ccap_foundationclassworkingfall2011') && !current_user_can('access_s2member_ccap_foundationclassauditingfall2011')) ||
        (bp_current_item() == 'hooligans' && !current_user_can('access_s2member_ccap_hooligan'))
    ))
    {
        header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
        exit;
    }
}
 

Statistics: Posted by Cristián Lávaque — November 4th, 2011, 12:52 am


]]>
2011-11-03T12:58:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50927#p50927 <![CDATA[Re: Buddypress group as custom capability?]]>
http://bpdevel.wordpress.com/2011/07/31 ... ity-slugs/

Statistics: Posted by peeld — November 3rd, 2011, 12:58 pm


]]>
2011-11-03T12:54:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50923#p50923 <![CDATA[Re: Buddypress group as custom capability?]]>
http://plugins.trac.wordpress.org/brows ... action.php

http://buddypress.trac.wordpress.org/br ... e.php#L946

Statistics: Posted by peeld — November 3rd, 2011, 12:54 pm


]]>
2011-11-03T12:29:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50919#p50919 <![CDATA[Re: Buddypress group as custom capability?]]>
EDIT: I also asked this question on the BP support groups:
Do the functions bp_is_groups_component and bp_current_item still work the same as they used to?

The answer was a simple Yes :)

Statistics: Posted by peeld — November 3rd, 2011, 12:29 pm


]]>
2011-11-03T12:01:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50914#p50914 <![CDATA[Re: Buddypress group as custom capability?]]>
Code:
/** s2member code */
add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
   {
   if (bp_is_groups_component() && bp_is_single_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworkingfall2011') && !current_user_can('access_s2member_ccap_goalsettingauditingfall2011')) {
    header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
    exit;
}
 
    else if (bp_is_groups_component() && bp_is_single_item() == 'runningcontacts-i' && !current_user_can("access_s2member_ccap_runningcontactsiworkingfall2011") && !current_user_can('access_s2member_ccap_runningcontactsiauditingfall2011'))
         {
                header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                exit ();
            }

   else if ( bp_is_groups_component() && bp_is_single_item() == 'agility-foundation' && !current_user_can("access_s2member_ccap_foundationclassworkingfall2011") && !current_user_can('access_s2member_ccap_foundationclassauditingfall2011'))
     {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
       }

   else if ( bp_is_groups_component() && bp_is_single_item() == 'hooligans' &&
!current_user_can("access_s2member_ccap_hooligan"))
    {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
   }
   
   }
/** end s2member code */

Statistics: Posted by peeld — November 3rd, 2011, 12:01 pm


]]>
2011-11-03T11:50:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50913#p50913 <![CDATA[Re: Buddypress group as custom capability?]]> My new session starts in a few weeks, hopefully I can suss this out by then...

Here's my updated code:
Code:
/** s2member code */
add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
   {
   if (bp_is_groups_component() && bp_current_item()  && bp_is_single_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworkingfall2011') && !current_user_can('access_s2member_ccap_goalsettingauditingfall2011')) {
    header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
    exit;
}
 
    else if (bp_is_groups_component() && bp_current_item() && bp_is_single_item() == 'runningcontacts-i' && !current_user_can("access_s2member_ccap_runningcontactsiworkingfall2011") && !current_user_can('access_s2member_ccap_runningcontactsiauditingfall2011'))
         {
                header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                exit ();
            }

   else if ( bp_is_groups_component() && bp_current_item() && bp_is_single_item() == 'agility-foundation' && !current_user_can("access_s2member_ccap_foundationclassworkingfall2011") && !current_user_can('access_s2member_ccap_foundationclassauditingfall2011'))
     {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
       }

   else if ( bp_is_groups_component() && bp_current_item() && bp_is_single_item() == 'hooligans' &&
!current_user_can("access_s2member_ccap_hooligan"))
    {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
   }
   
   }
/** end s2member code */

Statistics: Posted by peeld — November 3rd, 2011, 11:50 am


]]>
2011-11-03T11:44:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50912#p50912 <![CDATA[Re: Buddypress group as custom capability?]]> Statistics: Posted by peeld — November 3rd, 2011, 11:44 am


]]>
2011-10-29T23:18:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=50417#p50417 <![CDATA[Re: Buddypress group as custom capability?]]>
Look at the example near the bottom, it may help you:

Code:
Or if you wanted to show something on every single group page, regardless if it was the home page or not:

<?php if ( bp_is_groups_component() && bp_is_single_item() ) : ?> Show this on all single group pages <?php endif; ?>


Try adding && bp_is_single_item() to your conditions and see if it helps.

Statistics: Posted by Cristián Lávaque — October 29th, 2011, 11:18 pm


]]>
2011-10-27T21:13:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=49020#p49020 <![CDATA[Re: Buddypress group as custom capability?]]> http://codex.buddypress.org/developer-docs/conditional-template-tags/
seems to suggest bp_is_groups_component is still available as a function, bp_current_item function as well.

If a user isn't logged in (random visitor), any class they click on takes them back to the url that I've specified in the s2member options.

Used to be, if a user was logged in and had purchased access to a group, if they clicked on a group they DIDN'T have access to, they'd also go back to the s2member specified URL. Now, if they click on a group they don't have access to, they get taken to that group's home page. They still can't view any of the class content, but they can view the homepage, and it used to be they'd go back to the s2member page.

Hope that helps?

Statistics: Posted by peeld — October 27th, 2011, 9:13 pm


]]>
2011-10-27T17:31:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=49017#p49017 <![CDATA[Re: Buddypress group as custom capability?]]>
Also, have you checked that bp_is_groups_component and bp_current_item functions still exist in the BP you upgraded to?

Statistics: Posted by Cristián Lávaque — October 27th, 2011, 5:31 pm


]]>
2011-10-22T17:24:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=48569#p48569 <![CDATA[Re: Buddypress group as custom capability?]]>
Code:
/** s2member code */
add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
   {
   if (bp_is_groups_component() && bp_current_item() == 'goal-setting-and-mental-management' && !current_user_can('access_s2member_ccap_goalsettingworkingfall2011') && !current_user_can('access_s2member_ccap_goalsettingauditingfall2011')) {
    header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
    exit;
}
 
    else if (bp_is_groups_component() && bp_current_item() == 'runningcontacts-i' && !current_user_can("access_s2member_ccap_runningcontactsiworkingfall2011") && !current_user_can('access_s2member_ccap_runningcontactsiauditingfall2011'))
         {
                header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
                exit ();
            }

   else if ( bp_is_groups_component() && bp_current_item() == 'agility-foundation' && !current_user_can("access_s2member_ccap_foundationclassworkingfall2011") && !current_user_can('access_s2member_ccap_foundationclassauditingfall2011'))
     {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
       }

   else if ( bp_is_groups_component() && bp_current_item() == 'hooligans' &&
!current_user_can("access_s2member_ccap_hooligan"))
    {
      header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
   }
   
   }
/** end s2member code */


Using latest version of WP, BP, and S2Member 111017

Thanks,
Daisy

Statistics: Posted by peeld — October 22nd, 2011, 5:24 pm


]]>
2011-09-08T04:27:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=34287#p34287 <![CDATA[Re: Buddypress group as custom capability?]]>

Statistics: Posted by Cristián Lávaque — September 8th, 2011, 4:27 am


]]>
2011-09-07T12:04:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=34234#p34234 <![CDATA[Re: Buddypress group as custom capability?]]>

I'm by no stretch of the imagination a scripter, I'll hunt through the forums to see if there's something I can copy ;)

Thanks,
Daisy

Statistics: Posted by peeld — September 7th, 2011, 12:04 pm


]]>
2011-09-07T04:03:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=34205#p34205 <![CDATA[Re: Buddypress group as custom capability?]]> http://www.s2member.com/api-tracking-no ... ons-video/

Statistics: Posted by Cristián Lávaque — September 7th, 2011, 4:03 am


]]>
2011-09-05T23:38:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=34082#p34082 <![CDATA[Re: Buddypress group as custom capability?]]>
OK, so the customer clicks the Paypal button. They make a payment. They get a custom capability which allows them to SEE a group. Then, they still have to JOIN that group. I've actually removed the 'join group' button for now and am manually adding members for the moment. I feel like it's just one more layer of complexity that most users will be turned off by.

Is there a way to have people with the correct custom capability ALSO be given membership to the group that they've purchased access to? And then when they get demoted at the EOT their membership is also revoked from that group?

I'm not sure I'm making myself clear, I hope so. It's not a huge deal to manually add people as members to the BP groups at the moment. And of course S2Member works just fine; even if I added a random member to a group, they still couldn't SEE that group if they didn't have the correct ccap for it. So that's working as it should. Just curious about the ability to auto add members to a group they've got ccap for.

Daisy

Statistics: Posted by peeld — September 5th, 2011, 11:38 pm


]]>
2011-08-31T02:28:32-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=33483#p33483 <![CDATA[Re: Buddypress group as custom capability?]]> viewtopic.php?f=4&t=14719&p=33320#p33272 :)

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


]]>
2011-08-30T15:56:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=33383#p33383 <![CDATA[Re: Buddypress group as custom capability?]]> Darned logic.

Daisy

Statistics: Posted by peeld — August 30th, 2011, 3:56 pm


]]>
2011-08-29T02:34:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1405&p=33217#p33217 <![CDATA[Re: Buddypress group as custom capability?]]>

Code:
else if (bp_is_groups_component()  &&
    'goal-setting-and-mental-management' == bp_current_item() &&
    (!current_user_can ("access_s2member_ccap_goalsettingworking") || !current_user_can ("access_s2member_ccap_goalsettingauditing")))

   {header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      exit ();
   
}


EDIT: I tried rewording the statement to the below but that didn't work either. I'll admit I'm a PHP newbie and don't even fully understand what the "1" is at the beginning of the code. Really, I'd be happy to have two statements, one where if the user had the ccap goalsettingworking they got access at level 1 (and a level 1 role), and if they had the ccap goalsettingauditing they got level 2 access, simply because then they'd automatically have a different role assigned, although they would still be limited to viewing only the groups they had ccap for.

Code:
else 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 ();
   
}

Statistics: Posted by peeld — August 29th, 2011, 2:34 am


]]>