0

I made a custom form for forget password in WP.

below is the code that use:

 <form name="lostpasswordform" id="lostpasswordform" action="'.wp_lostpassword_url().'" method="post">
 <label for="user_login">Username:<br>
 <input name="user_login" id="user_login" class="input" value="" size="" type="text"></label><br><br>
 <label for="user_email">E-mail Address:<br>
 <input name="user_email" id="user_email" class="input" value="" size="" type="text"></label>
 <input type="hidden" name="" id="url_temp" value="'.str_replace( '%7E', '~', $_SERVER['REQUEST_URI']).'&axcelerate=forgotpassword">
 <input name="redirect_to" value="&user_login=&user_email=" type="hidden" id="lostpasswordform_addon"><br><br>
 <p class="submit">
 <input name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Get New Password" type="submit">
 </p>
 </form>

<script>
jQuery('#lostpasswordform #user_login').blur(function() {
        jQuery('#lostpasswordform_addon').val( jQuery('#url_temp').val() + '&user_login=' + jQuery(this).val() + '&user_email=' + jQuery('#lostpasswordform #user_email').val());
    });

    jQuery('#lostpasswordform #user_email').blur(function() {
        jQuery('#lostpasswordform_addon').val( jQuery('#url_temp').val() + '&user_login=' + jQuery('#lostpasswordform #user_login').val() + '&user_email=' + jQuery(this).val());
    });
</script>

I have a problem in the email value when I check into redirect_to the email format is correct eg. nameof@mail.com

but when I try to set up in a function suing this code:

if($_GET['axcelerate'] == 'forgotpassword'){
            echo $_GET['user_email'];
}

it returns nameofmail.com and not nameof@mail.com ?

does anyone have an idea about my case?

gadss
  • 21,687
  • 41
  • 104
  • 154
  • 1
    Try `&user_email=' + encodeURIComponent(jQuery(this).val())`. I also can't help but feel you're going about this the wrong way, jamming a URL into a form field – Phil Apr 01 '15 at 02:24
  • not the answer to your question, but it is not usual to have `INPUT` within `LABEL` element. you would actually write: `` – hexerei software Apr 01 '15 at 02:25
  • Also, selectors like `#lostpasswordform #user_login` are totally redundant. If you're using ID's, just select those, ie `#user_login` or `#user_email` – Phil Apr 01 '15 at 02:25
  • 1
    @hexereisoftware that's not unusual at all - http://stackoverflow.com/questions/774054/should-i-put-input-tag-inside-label-tag – Phil Apr 01 '15 at 02:26
  • @Phil you are completely right. i was stuck to old-school style there it seems. perfectly fine and actually preferable to encapsulate input with label element... sorry – hexerei software Apr 01 '15 at 02:32

0 Answers0