List of users based on usermeta
-
Hello everyone,
I’ve added to my wordpress website extra fields to the user profile. (meta_key= President, meta_value=on of off)
I try to list the users of my wordpress website where Predisent = On and sorted by last name.
A first try:
$Query = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'predisent' AND meta_value ='on' ")
Filter is ok, but i don’t know how to order by last name
A second try:
$Query = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key = 'last_name' ORDER BY $wpdb->usermeta.meta_value ASC")
This time, order is good… but no more filter (of course)
Is there someone here that can help me?
Thank you very much.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘List of users based on usermeta’ is closed to new replies.