$users = $wpdb->get_results ("SELECT DISTINCT(U.user_id) as `ID`
FROM " . $wpdb->usermeta . " AS U
inner join " . $wpdb->usermeta . " as UMF on U.user_id = UMF.user_id
inner join " . $wpdb->usermeta . " as UMS on U.user_id = UMS.user_id
inner join " . $wpdb->usermeta . " as UML on U.user_id = UML.user_id
WHERE UMF.meta_key = '" . $wpdb->prefix . "s2member_custom_fields'
AND UMF.meta_value REGEXP '.*\"".display."\";s:[0-9]+:\"".Yes."\".*'
AND UML.meta_key = '" . $wpdb->prefix . "capabilities'
AND UML.meta_value REGEXP '.*\"".s2member_level1."\";s:[0-9]+:\""."1"."\".*'");Statistics: Posted by epixmedia — December 6th, 2011, 4:49 am
]]>