AND meta_key = 'wp__s2member_custom_fields'
Statistics: Posted by peterhuk — May 18th, 2011, 5:07 pm
# PREP VARS
// vars for the Query
$group_name = ""; //get from the GroupManager's data, from s2m api Notification.
$group_name_chars = strlen($group_name);
// vars to update in each user (member) of the Group // also get from GroupMaster's data
$group_eot = '';
$group_cancel_date = '';
# FIND USERS IN THE GROUP
$tz_query = sprintf("SELECT * FROM $wpdb->usermeta WHERE meta_value LIKE '%%;s:10:\"group_acct\";s:%d:\"%s\";%%' ",$group_name_chars,$group_name);
$tz_results = $wpdb->get_results($tz_query,OBJECT); // result is an array of objects.
# UPDATE USERS IN THE GROUP
foreach ($tz_results as $group_member){
//echo $group_member->user_id; //test
# get
$user_id = $group_member->user_id;
$option_name = 's2member_custom_fields'; //set var
$s2m_custom_fields = get_user_option($option_name, $user_id); //get array
# set
$s2m_custom_fields['eot'] = $group_eot;
$s2m_custom_fields['cancel_date'] = $group_cancel_date;
$newvalue = $s2m_custom_fields;
$s2m_custom_fields_update = update_user_option( $user_id, $option_name, $newvalue );
}
Statistics: Posted by toddz88 — May 18th, 2011, 4:11 pm
Statistics: Posted by peterhuk — May 18th, 2011, 2:32 pm
So $wpdb was already invoked by the code i hooked into. Unless .. as I said in my original post .. i'm just not doing it correctly.
s:XX:"yourgroup";s:YY:"name"
SELECT * FROM wp_usermeta WHERE meta_key = 'wp__s2member_custom_fields'
AND meta_value LIKE '%s:5:"group";s:7:"Twitter"%'
Statistics: Posted by peterhuk — May 18th, 2011, 2:26 pm
..then during the registration process..
..search for the relevent group in a non S2m environment..
..includes the $wpdb class but you have not invoked the global class..
Statistics: Posted by toddz88 — May 18th, 2011, 1:47 pm
function my_other_field(){
$my_search = " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->prefix . "twitter' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
return $my_search;
}
global $wpdb;
Statistics: Posted by peterhuk — May 18th, 2011, 1:07 pm
Statistics: Posted by peterhuk — May 18th, 2011, 12:57 pm
$wp_user_search = new WP_User_Query( array(
'role' => 'subscriber'
) );
$my_group = $wp_user_search->get_results();
$args = array(
'meta_key' => 'aim',
'meta_value' => 'Bertha',
'meta_compare' => '='
);
$my_group = get_users( $args );
Statistics: Posted by toddz88 — May 18th, 2011, 10:23 am
Statistics: Posted by peterhuk — May 18th, 2011, 6:12 am
$query->query_where .= apply_filters ("ws_plugin__s2member_before_users_list_search_where_or_after", "", get_defined_vars ()) . ")"; /* Leaving room for additional searches here. */
add_filter ("ws_plugin__s2member_before_users_list_search_where_or_after", "my_other_field");
function my_other_field(){
$my_search = " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->prefix . "twitter' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
return $my_search;
}
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->prefix . "s2member_custom' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
Statistics: Posted by toddz88 — May 18th, 2011, 2:56 am