en WordPress.com Forums › Support List of users based on usermeta Author Posts October 24, 2010 at 3:13 pm #531995 kentiMember 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. October 24, 2010 at 3:13 pm #532205 supportbotMember You did not specify a blog address or reason for posting when you created this topic. This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums. If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful. If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question. This is an automated message. Author Posts The topic ‘List of users based on usermeta’ is closed to new replies.