Force assign Wishlist Member level to bbPress user role?

Hi,

Not sure if I can ask this here with my current membership level, so here goes nothing :wink:

I am working on a live project at the moment which is requiring the addition of BuddyPress and bbPress functionality to a membership site running on Wishlist Member. Specs for the site as follows:

WP: 3.6.1

bbPress: 2.4

BuddyPress: 1.8.1

Wishlist Member: 2.71.1440

Site URL: http://www.thelawofattraction.com

Because of the way in which WLM works it has also been necessary to install the Change Roles For WLM extension to make the upgrade to paid process work properly. This checks on login which role is assigned to an individual user and makes sure to map them to the upgraded role if they have paid.

The paid level is Platinum+ which I created a separate role for – platinumplus, and the default role for bbPress is set to Blocked to keep out everyone else.

I used the following code in my theme’s functions.php to map platinumplus membership level to the participant role:

add_filter('bbp_get_user_role_map','custom_bbPress_role_map');
function custom_bbPress_role_map($role_map){
$role_map['platinumplus'] = bbp_get_participant_role();
return $role_map;
}

I then output the result of the following code to the screen:

$role_map  = bbp_get_user_role_map();
print_r($role_map);
global $current_user;
get_currentuserinfo();
echo 'User ID: ' . $current_user->ID;
$role = bbp_get_user_role( $current_user->ID );
echo $role;
$role_caps = bbp_get_caps_for_role( $current_user->ID );
print_r( $role_caps );

and get this:

Array ( [administrator] => bbp_keymaster [editor] => bbp_blocked [author] => bbp_blocked [contributor] => bbp_blocked [subscriber] => bbp_blocked [platinumplus] => bbp_participant ) User ID: 695

bbp_blocked

Array ( [spectate] => 1 [participate] => 1 [read_private_forums] => 1 [publish_topics] => 1 [edit_topics] => 1 [publish_replies] => 1 [edit_replies] => 1 [assign_topic_tags] => 1 )

So, it would appear that a user is getting remapped by the WLM extension to the default role of bbp_blocked on login.

My question therefore is this – is there a way in which I can force the role platinumplus to occupy the participant user role on login? All users are redirected to a membership dashboard on login and it is feasible for me to have some code fire on this page to make sure that the bbPress participant role gets assigned to Platinum+ members as it should be. Just don’t know how to go about this.

Anyway, apologies for a possible wall of text – just wanted to be as thorough as possible in my first post :slight_smile: Any help at all would be much appreciated.

Best,

Iain