Example #1
0
/**
 * Forgot username form.
 *
 * This function creates a form for retrieving a forgotten username.
 *
 * @since 3.0.8
 *
 * @param  string $wpmem_regchk
 * @param  string $content
 * @return string $content
 */
function wpmem_page_forgot_username($wpmem_regchk, $content)
{
    if (!is_user_logged_in()) {
        global $wpmem;
        switch ($wpmem->regchk) {
            case "usernamefailed":
                $msg = __('Sorry, that email address was not found.', 'wp-members');
                $content = $content . wpmem_inc_regmessage('usernamefailed', $msg) . wpmem_inc_forgotusername();
                $wpmem->regchk = '';
                // Clear regchk.
                break;
            case "usernamesuccess":
                $email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
                $msg = sprintf(__('An email was sent to %s with your username.', 'wp-members'), $email);
                $content = $content . wpmem_inc_regmessage('usernamesuccess', $msg);
                $wpmem->regchk = '';
                // Clear regchk.
                break;
            default:
                $content = $content . wpmem_inc_forgotusername();
                break;
        }
    }
    return $content;
}
Example #2
0
/**
 * Forgot username form.
 *
 * This function creates a form for retrieving a forgotten username.
 *
 * @since 3.0.8
 *
 * @param  string $wpmem_regchk
 * @param  string $content
 * @return string $content
 */
function wpmem_page_forgot_username($wpmem_regchk, $content)
{
    if (!is_user_logged_in()) {
        global $wpmem;
        switch ($wpmem->regchk) {
            case "usernamefailed":
                $msg = $wpmem->get_text('usernamefailed');
                $content = $content . wpmem_inc_regmessage('usernamefailed', $msg) . wpmem_inc_forgotusername();
                $wpmem->regchk = '';
                // Clear regchk.
                break;
            case "usernamesuccess":
                $email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
                $msg = sprintf($wpmem->get_text('usernamesuccess'), $email);
                $content = $content . wpmem_inc_regmessage('usernamesuccess', $msg);
                $wpmem->regchk = '';
                // Clear regchk.
                break;
            default:
                $content = $content . wpmem_inc_forgotusername();
                break;
        }
    }
    return $content;
}