Display user meta by different user role

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 … Read more

Adding an additional role to an Administrator

use the profile_update hook and in the hooked function, run this check to make sure that it’s adding the previous data to the users profile on update too. if ( $update ){ do_action(‘profile_update’, $user_id, $old_user_data); }else{ do_action(‘user_register’, $user_id); } return $user_id; This answer can help you understand it more: WordPress edit_user_profile_update update secondary role

Assign second role to user

If you first fetch a WP_User object with get_userdata(), you should then be able to add your additional role with the add_role() method, like so: $user = get_userdata($user_id); $user->add_role(‘partner’);

Query users which have same dynamically generated roles as the current user

To achieve this, you first need to get all the current user roles, X and Y(s)… function get_current_user_roles(){ global $wp_roles; $current_user = wp_get_current_user(); $user_groups = groups_get_user_groups( $current_user->ID ); $user_roles = isset( $current_user->roles[‘X’] ) ? array( ‘X’ ) : array(); // Let’s get all Y dynamic user roles… foreach ( $user_groups[‘groups’] as $id ) { $group … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)