Statistics: Posted by martonic — February 14th, 2011, 9:27 pm
global $current_user;
$custom_fields = get_user_option("s2member_custom_fields");
$custom_fields["telephone"] = "999-999-9999";
update_user_option($current_user->ID, "s2member_custom_fields", $custom_fields);
Statistics: Posted by Jason Caldwell — August 27th, 2010, 1:39 pm
Statistics: Posted by martonic — August 21st, 2010, 9:01 pm
$user = new WP_User([ existing user ID or a Username is also fine ]);
$role = $user->roles[0]; // subscriber, or s2member_level[1 2,3,4]
$user = new WP_User(123);
echo $user->roles[0]; // s2member_level1
$user = new WP_User(123);
$user->set_role("s2member_level2");
Statistics: Posted by Jason Caldwell — August 5th, 2010, 3:26 pm
$key = "wp_capabilities";
$fields = get_user_meta($wp_id, $key, false);
$level = 0;
if ($fields != null && is_array($fields)) {
for ($i = 0; $level == 0 && $i < sizeof($fields); $i++) {
if (array_key_exists("s2member_level4", $fields[$i])) $level = 4;
else if (array_key_exists("s2member_level3", $fields[$i])) $level = 3;
else if (array_key_exists("s2member_level2", $fields[$i])) $level = 2;
else if (array_key_exists("s2member_level1", $fields[$i])) $level = 1;
}
}
Statistics: Posted by martonic — July 31st, 2010, 7:38 pm