RyanBayne / TwitchPress

TwitchPress is a system of plugins that combines the power of Twitch.tv with WordPress
http://twitchpress.wordpress.com
GNU General Public License v3.0
12 stars 6 forks source link

Create user join meta query function #244

Open RyanBayne opened 6 years ago

RyanBayne commented 6 years ago

Create user query function for joining meta and make it part of a WP library.

    $users = $wpdb->get_results( 
        "SELECT {$wpdb->users}.*, {$wpdb->usermeta}.meta_value as subplan FROM {$wpdb->users} 
        LEFT JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id
        WHERE {$wpdb->usermeta}.meta_key = '{$meta_key}'
        ORDER BY {$wpdb->users}.display_name"
    );