Hi there,
I've run in to a question - I've got the code working properly but need to implement the following, if possible. Right now, I'm using some code like this:
- Code: Select all
add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
{
if ( bp_is_groups_component() && 'groupA' == bp_current_item() && !current_user_can ("access_s2member_ccap_groupA"))
{
header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}
}
It's working great. However, I have two levels of paying students in each group, working spots and auditing spots. When I try to put an additional line in:
- Code: Select all
add_action ("template_redirect", "my_custom_capabilities", 1);
function my_custom_capabilities ()
{
if ( bp_is_groups_component() && 'groupA' == bp_current_item() && !current_user_can ("access_s2member_ccap_groupAauditing"))
{
header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}
}
The code is broken, I'm assuming because there's already an if statement for groupA?
Here's the question:
Can I have this as a possibility (users with two different ccap codes with access to the same group)?
ALSO, I notice that there is a '1' in the code, I'm assuming to make it Level 1. Would it be better to put another statement in there like this:
- Code: Select all
add_action ("template_redirect", "my_custom_capabilities", 2);
function my_custom_capabilities ()
{
if ( bp_is_groups_component() && 'groupA' == bp_current_item() && !current_user_can ("access_s2member_ccap_groupAauditing"))
{
header ("Location: " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}
}
for those auditing students? That *sounds* enticing, because then I could set all users who are 'working' to level 1, and have the role be "Working", and all users who are auditing to level 2, and the role could be "Auditing". It would be an easy way for me to keep track of who has paid for auditing and who has paid for working.
At the end of the day, it's OK if I can't; I can still have two Paypal buttons, and if people pay for auditing they pay one price with the same ccap code as the working people who pay more. They both get access, but it'll be trickier for me to keep track of who has paid for what.
Please advise.
Thanks!
Daisy