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.

S2Member + BuddyPress + bbPress

Home Forums Community Forum S2Member + BuddyPress + bbPress

This topic contains 12 replies, has 2 voices. Last updated by  Donna Bungard 3 years, 5 months ago.

Topic Author Topic
Posted: Tuesday Jun 18th, 2013 at 3:17 pm #52143

Putting together a membership portion of a site.

I have 5 membership levels (including 0) in s2member at different prices.

I am using the login to restrict access to only members.

I am creating forums that use BuddyPress categories for organization.

What I need to do now is have forum X be able to be read by 0< but only posted on by 3<. I have a feeling it's in the API script but not sure. Any help would be HUGE (gotta wrap this up!).

Thanks!
DB

List Of Topic Replies

Viewing 12 replies - 1 through 12 (of 12 total)
Author Replies
Author Replies
Posted: Wednesday Jun 19th, 2013 at 11:42 am #52218

bump

Posted: Tuesday Jun 25th, 2013 at 10:58 am #52546

OK I’ve removed BuddyPress from this – I think I should be able to do it with custom api but I am not sure how to do this. Anyone done this before?

Ive also installed the extended capabilities plugin but I think I will deactivate this – I see potential problems with that…

Posted: Wednesday Jun 26th, 2013 at 6:06 am #52601

Here’s the documentation for the s2Member-bbPress integration: [hilite path]Dashboard -› s2Member® -› Other Integrations -› bbPress®[/hilite]

Regarding s2Member’s Post Level Access Restrictions with bbPress®. Before you decide to use Post Level Access Restrictions, please take a look at: [hilite path]s2Member -› Restriction Options -› URI Access Restrictions[/hilite] and consider the following limitations in the current release of s2Member. It is currently NOT possible to protect a Forum, and have all Topics inside that Forum protected automatically. In order to accomplish that, you’ll need to use s2Member’s URI Access Restrictions. Also, s2Member is currently NOT capable of protecting Topic Tags; but you can use URI Restrictions for these also.

You may be able to use the URI restriction for all threads in a forum, if you manage to add a slug for the forum in the thread permalinks. Not sure if bbPress lets you do that, though, you’ll need to find out.

Posted: Wednesday Jun 26th, 2013 at 9:32 am #52608

Ok, that makes sense however I’m not well versed in writing this kind of thing.

Would it be something like:

Level 0
/professional-membership-2/&…something to cut off their ability to edit?? Then copy that to levels 1-3??

OR could I add soemthing like this to my functions.php file? (not a scripter so this may be a bit baraock – would love someone to help me clean it up if it would work)

<?php if (forum("professional-membership-2")
<?php if (current_user_can("access_s2member_level0")){ ?>
<style>
.bbp-reply-form{display:none;}
</style>
<?php }  ?>
<?php if (current_user_can("access_s2member_level1")){ ?>
<style>
.bbp-reply-form{display:none;}
</style>
<?php }  ?>
<?php if (current_user_can("access_s2member_level2")){ ?>
<style>
.bbp-reply-form{display:none;}
</style>
<?php }  ?>
<?php if (current_user_can("access_s2member_level3")){ ?>
<style>
.bbp-reply-form{display:none;}
</style>
<?php }  ?>
<?php }  ?>
Posted: Thursday Jun 27th, 2013 at 1:22 pm #52688

I also tried a version of what i posted above in my header file and that blew up. Thoughts? I’m not versed in this so if you have a better way please let me know / spell it out for me or show me a sample.

Posted: Friday Jun 28th, 2013 at 6:07 am #52724

I don’t have bbPress, so I’m not familiar with it and haven’t done this customization myself. These are just ideas I’m throwing out there in case they help.

Yes, you could probably do conditionals in the templates, but maybe it’s simple to add the forum slug to the topic permalink so you can use the URI restriction.

The conditionals above don’t look right. Every s2Member Level has access_s2member_level0, so that condition would basically be true for all members logged in and .bbp-reply-form won’t be displayed in forum professional-membership-2. Not sure if that’s what you meant.

If you need someone to do this for you, you can get a freelancer from sites like jobs.wordpress.net, elance.com or odesk.com.

Posted: Friday Jun 28th, 2013 at 10:22 am #52737

I almost have it = except now it’s targeting all levels. this is the code:


 <?php 
 if($post->ID == 2448){
	if (current_user_can("access_s2member_level0")){ 
echo '<style  type="text/css">
.bbp-reply-form{display:none;}
.bbp-topic-form{display:none;}
</style>';
} elseif (current_user_can("access_s2member_level1")){
echo '<style  type="text/css">
.bbp-reply-form{display:none;}
.bbp-topic-form{display:none;}
</style>';
} elseif (current_user_can("access_s2member_level2")){
echo '<style  type="text/css">
.bbp-reply-form{display:none;}
.bbp-topic-form{display:none;}
</style>';
} elseif (current_user_can("access_s2member_level3")){
echo '<style  type="text/css">
.bbp-reply-form{display:none;}
.bbp-topic-form{display:none;}
</style>';
} else {
}  
 }  ?>
  

The reason I”m specifying each level is because if I only say level 3 than levels 0, 1, & 2 would, by that logic, still be able to read it.

I’ve tested it – the bbPress portion – targeting the posts IS working. Its the s2Member part that’s tricky.
Thank you for any help!

Posted: Friday Jun 28th, 2013 at 9:10 pm #52763

Every level has access to content at its level and below, so s2Member Level 3 has access to level3, level2, level1 and leve0. Any user at Level 0 or higher will have access to level0. This is explained in the documentation, I recommend that you study it: [hilite path]Dashboard -› s2Member® -› API / Scripting -› Conditionals[/hilite]

Your code can be rewritten like this:

[hilite pre_code]
ID == 2448 && current_user_can("access_s2member_level0")) { ?>

';

[/hilite]

See:
http://www.php.net/manual/en/language.operators.logical.php
http://reference.sitepoint.com/css/selectorgrouping

Now, that conditional will include Level 4 users or higher too (and your code does), but if what you want is that it’s only true for Level 3 users or lower, you could do it like this:

[hilite pre_code]
ID == 2448 && !current_user_can("access_s2member_level4")) { ?>

';

[/hilite]

Exclamation mark before the check means “false” so in this case “it’s false that the user can access level4” or “user can’t access level4”. http://www.phpreferencebook.com/samples/equal-sign-operators/

Posted: Monday Jul 8th, 2013 at 11:57 am #53122

Hi – sorry had my vaca and didn’t get back to that!

So that works for specific posts – now how can I get that to target all of the topics under those posts?
Maybe something based of URL since forums go by URL?

Posted: Tuesday Jul 16th, 2013 at 3:15 pm #53527

Any thoughts?

Posted: Tuesday Jul 16th, 2013 at 9:02 pm #53538

Maybe, I haven’t looked into that before so I don’t know the exact answer. You may want to google it, or ask in a WP forum for help on how to do that.

Posted: Wednesday Jul 17th, 2013 at 3:54 pm #53582

Found a topic that helped a little – here is what I have – not giving an error but not working – still need to refine it.


<?php
$uri = $_SERVER["REQUEST_URI"];
$uri_array = split("/",$uri);
$uri_first = $uri_array[1]; // might need to change this to [1]
?>
<?php if ($uri_first == 'professional-membership-2' && !current_user_can("access_s2member_level4") ){ ?>
<style type="text/css">
	.bbp-reply-form, .bbp-topic-form {display: none;}
</style>';

<?php } ?>
Viewing 12 replies - 1 through 12 (of 12 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

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.