Left Join Users and Usermeta
-
Hey
I’m trying to output a list of all users (with preference “visible”) for my site in a table with a few columns, but I need to draw information from both the users and usermeta table.
I am using this foreach
<?php $order = '$wpdb->users.user_nicename'; $users = $wpdb->get_results( "SELECT * FROM $wpdb->users LEFT JOIN $wpdb->usermeta ON($wpdb->wp_users.ID = $wpdb->usermeta.umeta_id) WHERE $wpdb->usermeta.account_status = 'Visible' ORDER BY $order"); foreach($users as $user) : ?>
But nothing returns.
Can anyone help or help me perhaps make use of wp_list_authors instead.
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Left Join Users and Usermeta’ is closed to new replies.