latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

How to get array of user-id's by custom field

Home Forums Community Forum How to get array of user-id's by custom field

This topic contains 1 reply, has 2 voices. Last updated by  Bruce 3 years, 9 months ago.

Topic Author Topic
Posted: Tuesday Apr 9th, 2013 at 3:15 am #46877

Hello,

I want to creat a list of users on my website. I want to get the user id’s in an array by user custom registration fields.
I have a checkbox input on the registration form.
The uniek-id is model_category.
The posible values are:
Fashion
Real
Special
Acteurs

I want to use something like this to get the Id’s of a groep of users.

$UserIDs = $wpdb->get_col( $wpdb->prepare(“SELECT $wpdb->users.ID FROM $wpdb->users XXXX”)

XXXX need to do this: WHERE model_category contains “Fashion”

But I can’t figure out how to do this. I;m not that good with SQL Querys.

I have also tryed this (but it didn’t work):
$wpdb->get_col (“SELECT user_id as ID FROM ” . $wpdb->usermeta . ” WHERE meta_key = ‘” . $wpdb->prefix . “s2member_custom_fields’ AND meta_value REGEXP ‘.*”model_category”;s:[0-9]+:”‘Fashion’”.*’”);

Can you please help me out?

Thank you.

Kees Veerman

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Wednesday Apr 10th, 2013 at 1:28 am #47010
Bruce
Username: Bruce
Staff Member
Viewing 1 replies (of 1 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.