Create dropdown of users in admin dashboard


I’m trying to make a list of users come up in a widget in the admin dashboard. So far i’ve got it showing up, but I want the list to show a custom field from the user’s profile instead of the normal display_name or ID.

My code so far:

    function wps_userlist_dw() {

wp_dropdown_users(array('name' => 'author',
         'exclude'                 => '1',
         'name'                    => 'author',
         'selected'                 => $user_id,
         'show'                    => 'ID'

function add_wps_userlist_dw() {
       wp_add_dashboard_widget( 'wps_userlist_dw', __( 'Select a User Below' ), 'wps_userlist_dw' );
add_action('wp_dashboard_setup', 'add_wps_userlist_dw' );

So instead of ID, i need a custom field (made via Cimy Extra User Fields – Lets say the custom field’s name that i want to show is ‘COMPANYNAME’.

Any thoughts?
If i put in ‘COMPANYNAME’ in the ‘show’ value, the whole function doesn’t show up.


, , Aaron 10 years 2013-08-27T20:44:09-05:00 0 Answers 85 views 0

Leave an answer