Example #1
0
function umc_info_setpass()
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    global $UMC_USER;
    $uuid = $UMC_USER['uuid'];
    $user_login = umc_wp_get_login_from_uuid($uuid);
    // get userdata
    // this code is copied from wp-login.php, round line 325, grep for 'get_password_reset_key'
    $user_data = get_user_by('login', $user_login);
    $reset_key = get_password_reset_key($user_data);
    $url = network_site_url("wp-login.php?action=rp&key={$reset_key}&login="******"Password Reset Link");
    umc_echo("Please click on the following link to set a new password:");
    umc_echo($shortenedurl);
    umc_footer();
}
/**
 * Set a meta-value for a user
 *
 * @param string $uuid
 * @param string $meta_key
 * @param string $meta_value
 */
function umc_wp_set_meta($uuid, $meta_key, $meta_value)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    global $UMC_USER;
    $current_uuid = $UMC_USER['uuid'];
    if ($uuid == $current_uuid) {
        $user = wp_get_current_user();
    } else {
        $user_login = umc_wp_get_login_from_uuid($uuid);
        $user = get_user_by('login', $user_login);
    }
    $check = update_user_meta($user->ID, $meta_key, $meta_value);
    if (!$check) {
        XMPP_ERROR_trigger("Unable to set User Meta {$meta_key} to {$meta_value} for user {$uuid} and ID" . $user->ID);
    }
}