• Resolved David Okoli

    (@enochdavid)


    Hi,
    I would to create user roles and output them on the friend. Is there a way I can do this with your plugin or I need an add-on plugin for this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    You can assign a user role to the user on registration. For this, you need to set the user role at the option “User Role to Assign” in the form option of the account form builder. I am not sure where you want to output? Can you provide a screenshot?

    Regards,
    Patrik

    Thread Starter David Okoli

    (@enochdavid)

    Okay,
    Thank you very much, I get it. I have been able to create the roles I want and the roles are visible on the registration form.

    As for the output on frontend(sorry I meant frontend, not friend), here is what I want below:
    In the users page and also on the author’s page, I would love to output the user role besides the users’ name or photo.

    Plugin Contributor Paolo

    (@paoltaia)

    Hi,

    for the profile page you can use the UWP > User Meta block (or shortcode or widget) with the key User Role.

    On the author page, I’m not sure that will work, I’ll ask Patrik to reply.

    Thanks,

    Hi,

    There is no direct way to do it but we have hooks and filters in our plugin which can be used to add content after the user name on the profile page. You can try following code and modify according to your needs:

    add_action( 'uwp_profile_after_title', 'uwp_profile_after_title_cb', 9, 1 );
    function uwp_profile_after_title_cb($user_id){
    	global $uwp_in_user_loop;
    	$user = get_userdata( $user_id );
    
    	if ( ! $uwp_in_user_loop && $user && is_user_logged_in() && isset($user->roles[0]) ) {
    		echo '<span>('.$user->roles[0].')</span>';
    
    	}
    }

    Let me know if it helps.

    Regards,
    Patrik

    Thread Starter David Okoli

    (@enochdavid)

    Thank you @patrick for your solution, that one worked

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘User roles and output’ is closed to new replies.