Page 1 of 1

Adding Roles

PostPosted: March 8th, 2011, 10:51 am
by wesleysoccer
Is it possible that when a Member Level #1 or #2 join my site that I can give them a subscriber role as well (inside of WP users admin)?

This will help with my bbpress forums...So can they be given two roles each time they join my site?
Member Level #1 and Subscriber Roles...

Right now I have to maually change users roles inside of bbpress...not fun. Thanks.

Re: Adding Roles

PostPosted: March 8th, 2011, 8:50 pm
by Jason Caldwell
Whenever a Members signs up on your WordPress site, they are assigned a Role matching the type of registration that was completed. Either Level #0 ( Free Subscriber ) , or one of the paid s2Member Roles with Level # 1-4. Then, the first time they attempt to access your bbPress installation, s2Member will automatically assign them a bbPress role of "Member" on your bbPress installation. In order for this to work as expected, you must have the s2Member -> bbPress Bridge installed. Please check your Dashboard under: s2Member -> API Bridges -> bbPress.

Thanks for the info...my problem is when bbbridge is installed the general public can not see the forums? Is there a fix?
After you install the s2Member -> bbPress Bridge in your Dashboard, you can open this file, it's inside: /bb-plugins ( or my-plugins ) /_s2member-bbpress-bridge.php.

Look for this section in that file:
Code: Select all
if (!bb_is_user_logged_in () || !bb_current_user_can ("participate"))
    {
        if ($url = bb_get_option ("wp_siteurl")) /* WordPress® is integrated? */
            {
                $bbPress = bb_get_option ("uri"); /* bbPress® location. */
                /**/
                if (preg_match ("/^" . preg_quote ($bbPress, "/") . "/", $_SERVER["HTTP_REFERER"]))
                    wp_redirect ($url, apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
                /**/
                else /* Otherwise, trigger the Membership Options Page + s2member_level_req = $min. */
                    wp_redirect ($url . "/?s2member_membership_options_page=1&s2member_seeking=bbpress&s2member_level_req=" . urlencode ($min), apply_filters ("ws_plugin__s2member_content_redirect_status", 301, get_defined_vars ()));
                /**/
                exit ();
            }
    } 

Try changing that to just this:
Code: Select all
if (!bb_is_user_logged_in () || !bb_current_user_can ("participate"))
    { /* Do nothing. */ } 

* NOTE. This is untested code. Please use at your own risk.

Re: Adding Roles

PostPosted: March 8th, 2011, 9:02 pm
by Jason Caldwell
For the benefit of other readers.

The short answer is no, because in order to integrate bbPress with s2Member, you must first integrate bbPress with WordPress. That integration with WordPress creates a map of bbPress Roles -> WP Roles. Then ( optional ) the s2Member Bridge can come in with 4 new Roles ( s2Member Level 1-4 ) and it can also offer protection of the forums; even at Level #0 if you like. But, if you are planning to leave your forums open to the public, there really is no reason to install the Bridge. The only reason to install the Bridge ( under normal circumstances ) is to protect the forums with s2Member, by requiring a specific s2Member Access Level. s2Member's Bridge also redirects registration requests on the forums back to the Membership Options Page on the main WordPress site.

Integrating bbPress is fairly complicated. It requires a lengthy process inside your bbPress admin panel, following instructions provided by the creators of bbPress. Then you have to install this plugin into WordPress. http://wordpress.org/extend/plugins/bbp ... tegration/ This gets bbPress integrated with WordPress. So the only reason to add s2Member into the mix after this, is to prevent public access.