BuddyDev

Search

bp_get_member_type, unassign member_type to user

  • Participant
    Level: Initiated
    Posts: 2
    Nicolas Joly on #35916

    Hi,

    I have 2 users with member types ‘wp-test’

    In functions.php, i just write this :
    $member_type = bp_get_member_type( 2 ); // userid 2

    After in Users list with filter by member types ‘wp-test’, i have well 2 users, but the Member types in the list disappear for the user 2 ???

    https://i.gyazo.com/2e9a26c154b1277b2a214617bf5e946b.png

    An idea ?
    Thank you !

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2459
    Ravi on #35927

    Hello Nicolas,

    Thank you for posting. Direct calling is a bad idea because member type might be not registered at the time of calling. Please try something like following:

    
    add_action( 'bp_template_redirect', function () {
    	$member_type = bp_get_member_type( 24 );
    	
    } );
    
    

    Please let me know if you need further assistance.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved