It works great - but is there an option to show not the display_name, but a custom field? such as my clinic-name? when I insert this instead of "display_name" i get nothing.
I'm not trying to get the current user, I'm trying to get a list of all users.
It worked before, the only thing that I wanted to change was that the options in the select box will display not the username, but the custom field "clinic-name").
Thanks for writing back and sorry if my message caused confusion.
When I wrote "You can use this inside your shortcode's loop", I meant inside the "foreach { ... }" block.
( screenshot: hidden link )
That "foreach" block is cycling through the user's list one user per iteration, which means that in each loop's iteration "$user->ID" will return the ID of a different user in that list.
( this is what I referred to as the current user and not the currently logged-in user )
Note: with the current position of $field_value, you're only getting currently logged-in user's value because at that point $user->ID is not defined and "user_id" gets a blank value, and the "types_render_usermeta" function falls back to return the value from the currently logged-in user.