In your author.php
file, get the user metadata via get_user_meta(), then do an if statement of $user->roles == 'rivenditore'
, display the meta data as you desire, and then do an elseif $user->roles == 'installatori'
statement with what you wish to display for users on other roles.
EDIT: Code example as requested:
// get author data
$queried_object = get_queried_object();
// set author ID
$author_id = $queried_object->ID;
// get author roles in array
$roles_arr = $queried_object->roles;
// get the meta data, I set it to 'location' just to show you how it works
$user_meta_location = get_user_meta($author_id, 'location', TRUE);
if ($roles_arr[0] == 'rivenditore') {
// do stuff for rivenditore users
echo $user_meta_location;
} elseif ($roles_arr[0] == 'installatori') {
// do other stuff for installatori users
echo $user_meta_location;
}
I haven’t tested it but it should work. Note that I have no idea what the key is for your meta_data so please set that. I have added comments so everything should be readable for sure. Good luck!