• Resolved missveronica

    (@missveronicatv)


    UM Documentation requires update of this Page

    https://docs.ultimatemember.com/article/165-getrolename

    The function get_role_name requires a parameter equal to a Role ID or a Role slug.

    Example of usage should be like this

    $role_name = UM()->roles()->get_role_name( UM()->user()->get_role());

    UM Source code:

    /**
     * Get role name by roleID
     *
     * @param $slug
     * @return bool|string
     */
    function get_role_name( $slug ) {
    	$roledata = $this->role_data( $slug );
    
    	if ( empty( $roledata['name'] ) ) {
    		global $wp_roles;
    
    		if ( empty( $wp_roles->roles[$slug] ) )
    			return false;
    		else
    			return $wp_roles->roles[$slug]['name'];
    	}
    
    	return $roledata['name'];
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘UM Documentation’ is closed to new replies.