<?php
function users_in_database ()
{
global $wpdb; /* Global database object reference. */
/**/
$q1 = mysql_query ("SELECT SQL_CALC_FOUND_ROWS `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql ($wpdb->prefix . "capabilities") . "' LIMIT 1", $wpdb->dbh);
$q2 = mysql_query ("SELECT FOUND_ROWS()", $wpdb->dbh);
/**/
$users = (int)mysql_result ($q2, 0);
/**/
mysql_free_result ($q2);
mysql_free_result ($q1);
/**/
return $users;
}
?>
Statistics: Posted by Jason Caldwell — November 23rd, 2011, 1:28 pm
Statistics: Posted by epixmedia — November 23rd, 2011, 12:09 pm
<?php
foreach (get_users () as $user)
{
$user = /* Get full WP_User object instance. */ new WP_User ($user->ID);
if /* If they're at least a "Subscriber", possibly a "Member". */ ($user->has_cap ("access_s2member_level0"))
{
echo get_user_field ("my_unique_field_id", $user->ID);
}
}
?>
Statistics: Posted by Jason Caldwell — November 22nd, 2011, 12:35 pm
<?php
global $wpdb;
$users = $wpdb->get_results ("SELECT `user_id` as `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_custom_fields'");
if (is_array ($users) && count ($users) > 0)
{
foreach ($users as $user)
{
$user = /* Get full User object now. */ new WP_User ($user->ID);
print_r($user); /* Get a full list of properties when/if debugging. */
}
}
?>
Statistics: Posted by epixmedia — November 22nd, 2011, 7:29 am
$query = "SELECT * FROM `".$wpdb->usermeta."` WHERE (`meta_key` = '".$wpdb->prefix."s2member_custom_fields') AND (`meta_value` LIKE '%".esc_sql(like_escape($professione))."%') AND (`meta_value` LIKE '%".esc_sql(like_escape($paese))."%') ORDER BY `user_id` DESC";
Statistics: Posted by Jason Caldwell — November 9th, 2011, 5:18 pm
$query = "SELECT * FROM $wpdb->usermeta WHERE (`meta_key` = 'wp_s2member_custom_fields') AND (`meta_value` LIKE '%$professione%') AND (`meta_value` LIKE '%$paese%') ORDER BY wp_usermeta.wp_user_level DESC"
Statistics: Posted by nemoprincess — November 9th, 2011, 3:50 pm
SELECT `user_id` as `ID` FROM `wp_usermeta` WHERE `meta_key` = 'wp_s2member_custom_fields' AND `meta_value` REGEXP '.*"my_unique_field_id";s:[0-9]+:"string value I am looking for".*'
SELECT `user_id` as `ID` FROM `wp_usermeta` WHERE `meta_key` = 'wp_s2member_custom_fields' AND `meta_value` REGEXP '.*"country_code";s:[0-9]+:"US".*'
<?php
global $wpdb;
$users = $wpdb->get_results ("SELECT `user_id` as `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_custom_fields' AND `meta_value` REGEXP '.*\"country_code\";s:[0-9]+:\"US\".*'");
if (is_array ($users) && count ($users) > 0)
{
foreach ($users as $user)
{
$user = /* Get full User object now. */ new WP_User ($user->ID);
print_r($user); /* Get a full list of properties when/if debugging. */
}
}
?>
Statistics: Posted by Jason Caldwell — October 26th, 2011, 2:08 pm
Statistics: Posted by nemoprincess — October 25th, 2011, 3:58 pm