Display user role_name instead of role id
-
Hello Everyone!
Using this code:
$aanmelding = $EM_Booking->get_person()->ID; $user = new WP_User( $aanmelding ); if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo '<li>'. $EM_Booking->get_person()->get_name() .' - ' . $role .' - Aantal personen : ' . $EM_Booking->get_spaces() . '</li>'; }
I’m displaying the user role of an attendee to an event. However, I’d like to display the user role name instead of the user id. That way I can edit it easily with the user role plugin I’m using. Plus, its a lot more good looking than administrator_event_contributor
I’ve tried to get it work but so far no dice.
You can see it (almost) working on this page: https://www.airsoftclubnederland.nl/evenementen/bunker-hill/
- The topic ‘Display user role_name instead of role id’ is closed to new replies.