Add Member type in body class for logged in user

Home Forums Legacy Support Support queries How-to & Troubleshooting Add Member type in body class for logged in user

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #387507
    dolphspeed
    Participant
    Hi there, I have created 3 type members. A = student B = instructor C = instructor with different name , partner I want for the type C member, to add in the body class the name member-type-partner This body class is added already but only when member type C access his dashboard ( bp-user member-type-partner my-account dashboard ). I want the class to be in body as long as the user type is logged in. How can I do this? Thanks in advance.
    #387537
    Veronica
    Moderator
    hi, for this you need to enable both the sync in wp-admin>>vibebp>>settings
    add_filter('body_class',function($classes){
    	$m_types = bp_get_member_type( get_current_user_id(),false );
    	if(empty($m_types)){
    		$m_types = [];
    	}
    	if(in_array('custom_type', $m_types)){
    		$classes[] = 'custom_type_class';
    	}
    	return $classes;
    });
    add this code in wp-admin>>plugins>>plugin editor>>wplms-customizer.php
    #387548
    dolphspeed
    Participant
    Thanks for your help. I`m on version 3.9.9 and don't have vibebp plugin installed. Where can I enable both the sync Thanks in advance. PS: Can`t upgrade to 4.0 , I need WPLMS Application Forms to work, and in 4.0 is not working yeat.
    #387568
    Veronica
    Moderator
    add_filter('body_class',function($classes){
    	$m_types = bp_get_member_type( get_current_user_id(),false );
    	if(empty($m_types)){
    		$m_types = [];
    	}
    	if(in_array('custom_member_type', $m_types)){
    		$classes[] = 'custom_type_class';
    	}
    	return $classes;
    });
    NOTE: please change custom_member_type with your provided/custom member type
    #387569
    Veronica
    Moderator
    add this code in wp-admin>>plugin>>plugin editor>>wplms-customizer.php
    #387573
    dolphspeed
    Participant
    Works perfectly . Many Thanks
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add Member type in body class for logged in user’ is closed to new replies.