Skip to:

Override auto role for single membership level in Wishlist Member?

  • jakestambridge


    Just wondering if this is possible – 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.1747
    Site URL:

    The idea is that we are implementing a paid-for membership level managed by WLM and Infusionsoft. At the moment I have set auto role to ‘Blocked’ and reset the assigned bbPress user roles so that all existing (non-paying) members are set to this.

    However, I’d like all new members registering as paid-for (Platinum+, platinumplus) to be assigned the Participant role.

    I tried like so in my functions.php:

    function custom_bbPress_role_map($role_map){
    $role_map['platinumplus'] = bbp_get_participant_role();
    return $role_map;

    but although I can echo out the result of bbp_get_user_role_map() and see that this has worked in theory the Platinum+ members remain set as ‘Blocked’.

    First time using bbPress so please forgive me if I’ve overlooked anything really obvious here, but any help would be appreciated.


Viewing 1 replies (of 1 total)

  • iaincrossley


    Just replying to myself on here, given the lack of interaction, with the solution to this.

    Place the following code in your theme’s functions.php – this will allow mapping of a particular WLM membership level to the bbPress Participant level:

    function map_bbpress_user_role(){
    	//get the user class
    	$cu = wp_get_current_user();
    	$cu_roles = $cu->roles; //get the user roles
    	if(in_array("administrator", $cu_roles)) return; //disregard if admin
    	$isplatinumplus =  in_array("platinumplus", $cu_roles); //check if it has platinumplus role
    	$isblocked = array_search(bbp_get_blocked_role(),$cu_roles); //check if it has bbp_blocked role
    	if($isplatinumplus){ //if it has platinumplus role
    		$cu->add_role(bbp_get_participant_role()); //add aparticipant role
    		if($isblocked !== false){ //if it has bbp_blocked role
    			$cu->remove_role(bbp_get_blocked_role()); //remove it
    	}elseif($isblocked === false){ //if he is not platinumplus and dont have bbp_blocked
    		* 	This part makes sure that only platinumplus roles have access to the forum
    		$cu->add_role(bbp_get_blocked_role()); //add bbp_blocked

    I used the Members plugin to create a platinumplus user role that then mapped to the WLM level of the same name, and the above code then mapped that role to the appropriate bbPress one. Obvs, any instances of ‘platinumplus’ have to be amended to the role you are intending to map.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar