• Resolved Nitrat

    (@nitrat)


    Hello!
    How to take the value of community role? such code does not work –

    add_filter('gform_field_value_um_user_role', 'gform_populate_um_user_role');
    function gform_populate_um_user_role(){
    	$current_user = wp_get_current_user();
    	$user_id = $current_user->ID;
    	
    	$UM_User_Role = 'N/A';
    	
    	if ($user_id) {
    		global $ultimatemember;
    	
    		um_fetch_user( $user_id );
    		$UM_User_Role = $ultimatemember->user->get_role();
    	}
    	
    	return $UM_User_Role;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Towhid

    (@cryptex_vinci)

    Hi @nitrat

    You can try using native WordPress functions to get the role.

    <?php 
    
    function gform_populate_um_user_role(){
       if( is_user_logged_in() ) {
         $user = wp_get_current_user();
         $user_role = $user->roles[0];
         return $user_role;
      }
    }
    
    ?>

    Thanks

    Thread Starter Nitrat

    (@nitrat)

    Hi Asif
    Thank you, but I do not need the role of WordPress. I need the role of the Ultimate member community – um_role

    UM Roles mirror WP Roles. Or don’t they?

    • This reply was modified 5 years, 9 months ago by Eugene.
    Plugin Support Towhid

    (@cryptex_vinci)

    Hi @euguk007, @nitrat

    Yes. UM uses the native WordPress roles.

    Thanks

    Thread Starter Nitrat

    (@nitrat)

    This is not true. The roles created by the Ultimate member are not native

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi,

    I’m closing this ticket temporarily due to inactivity. If you’re still having an issue/concern, just reply to this thread and mark this as “Not resolved” so we can continue assisting you.

    Regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘User role’ is closed to new replies.