Create a Custom Forgot Password Page In WordPress
Here we will explain to you how to create a custom forgot password/reset password page in WordPress. This tutorial will help for making the custom front-end page where your subscriber, author, and many other roles of users will change their password to the system.
Step 1)
Make one template page in the WordPress active theme folder and put the below code there.
<?php
/* Template Name: Forgot Password Template */
get_header();
global $wpdb;
if( (isset($_REQUEST['update_confirm'])) AND ($_REQUEST['update_confirm']='update_confirm') ){
$newpass=md5($_POST['newpass']);
$usernameemail=$_POST['useremail'];
$kkey =$_POST['key'];
$wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_pass='".$newpass."',user_activation_key='' WHERE (user_login='".$usernameemail."' OR user_email='".$usernameemail."') AND user_activation_key='".$kkey."' "));
echo "<span class='msgg-ok'>Your password has been reset.<br> <a href='/user-login/'>Log in</a></span>";
}
if( (isset($_REQUEST['update'])) AND ($_REQUEST['update']=='update')){
$username_email=$_POST['uemail'];
$Qry = $wpdb->get_results("SELECT user_login,user_email FROM $wpdb->users WHERE user_login='".$username_email."' OR user_email='".$username_email."'");
if($Qry[0]->user_login != '' && $Qry[0]->user_email != ''){
$email = $Qry[0]->user_email;
$user = $Qry[0]->user_login;
$homeurll=home_url('/');
$autogenerate_key =crypt($username_email);
$wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_pass='".$newpass."',user_activation_key='".$autogenerate_key."' WHERE (user_login='".$username_email."' OR user_email='".$username_email."') "));
$mailmsg="Someone requested that the password be reset for the following account:\n$homeurll.\n\nUsername: $user\n\nIf this was a mistake, just ignore this email and nothing will happen.\n\nTo reset your password, visit the following address:\n$homeurll/forgot-password/?action=rp&key=$autogenerate_key&login=$user";
mail($email,'[The Pacifico Partnership] Password Reset',$mailmsg);
echo "<span class='msgg-ok'>Check your e-mail for the confirmation link.</span>";
}else{
echo "<span class='msg-errr'>Username or Email is not found.</span>";
$notfound="errror";
}
}
?>
<?php if($_GET['action']=='rp'){ ?>
<style>
#forget_display{display:none;}
</style>
<?php }
if((!$_POST) OR ($notfound!='')){
?>
<div id='forget_display'>
<form action='' method='post' onsubmit='return blank_field();'>
<div > <label>Please enter your username or email address.You will receive a link to create a new password via email.</label><br /><br />
<div> <input name='uemail' type='text' id='uemail' onfocus="if(this.value=='Enter Username/E-mail') this.value=";" onblur="if (this.value=='')
this.value='Enter Username/E-mail';" placeholder='Enter Username/E-mail'/></div> <input type='submit' value='Get New Password'/> </div>
<input type='hidden' name='update' value='update' />
</form>
</div>
<?php }?>
<?php if( (isset($_REQUEST['action'])) AND ($_REQUEST['action']=='rp')) {?>
<div>
<form action="<?php echo home_url('/') ?>?page_id=9" method="post" onsubmit="return blank_pfield();">
<div>
<label>Enter new password:</label><div> <input name="newpass" type="password" id="newpass"/> </div></div><br />
<div><label>Repeat password:</label><div> <input name="repeat-pass" type="password" id="repeat-pass"/> </div></div><br />
<div><label> </label> <input type="submit" value="Change password" /></div>
<input type="hidden" name="update_confirm" value="update_confirm"/>
<input type="hidden" value="<?php echo $_REQUEST['login'];?>" name="useremail" />
<input type="hidden" name="key" value="<?php echo $_REQUEST['key'];?>" />
</form>
</div>
<?php }?>
<script>
function blank_field()
{
if(document.getElementById('uemail').value=='Enter Username/E-mail')
{
alert("Please enter username or email");
return false;
}
else
{
return true;
}
}
function blank_pfield()
{
if(document.getElementById('newpass').value=='')
{
alert("Please enter new password");
return false;
}
if(document.getElementById('repeat-pass').value=='')
{
alert("Please enter repeat password");
return false;
}
if(document.getElementById('newpass').value!=document.getElementById('repeat-pass').value)
{
alert("Password do not match");
return false;
}
return true;
}
</script>
<?php get_footer(); ?>
<style>
.choko_register_box{margin: 0 auto;width: 50%;}
.choko_register_row_ctn{margin-bottom: 15px;}
.choko_register_row_ctn label{display: block;margin-bottom: 10px;}
.choko_register_row_ctn input{width: 97%;border-radius: 0}
.choko_register_row_ctn select{width: 100%;border-radius: 0}
.choko_register_error_msg{color: red;margin-bottom: 15px;}
</style>
Step 2)
Now make a forgot password page in wp-admin/add new page. and select the "Forgot Password Template" as a template page. Update your page.
Step 3)
Now visit your page in the front end; it will display the custom forgot password form, where if the user exists, it will send an email link to reset the new password.
Great goods from you, man. I’ve understand your stufff previous to and you are just tooo excellent.
I really liike whbat you have acquired here, really like
what you are stating and the way in which you say it. You make
it entertaining and you still care for to keep iit wise.
I can not wait to read far more from you. This is actually a tremendohs site.
Your method of describing everything in this article is in fact nice, every one be able to without difficulty know it, Thanks a lot.
Been using Craybet for like two months now and figured I’d share my experience because there’s not much discussion about it around here. Signed up randomly one night and signing up took maybe a couple minutes. Min deposit was ten bucks which is about what you’d expect. They threw in a welcome bonus — matched my first deposit 100% up to 500 and 50 free spins on Gates of Olympus. Rollover is 35x and that is kinda average but I’ve dealt with worse.
Their slots catalog is bigger than I expected. There’s titles from Pragmatic Play, Evolution, plus Big Time Gaming — so like Gates of Olympus, Gonzo’s Quest, the usual heavy hitters. I’d guess maybe a couple thousand titles when you add it all up. Live casino uses Evolution and it’s legit — played some roulette and Lightning Roulette with actual croupiers and zero lag issues.
Now the one thing that kinda bugged me was withdrawal times. I used Visa and waited almost two days for my first withdrawal. After that though it was faster. They accept credit cards, Skrill, Neteller, and BTC which covers most bases. I’d check out what they’ve got going on on svnewtech to see for yourself.
Using Craybet from my iPhone is actually smooth. There’s no app to download but the browser version runs well and slots and live games work fine. Was playing Book of Dead in bed and didn’t notice any problems.
Customer service on Craybet is decent — they have live chat that gets you a person pretty quick usually. Had to ask about a bonus that didn’t credit and got it fixed within hours. Not sure about Curacao-based from what I can tell which is standard for offshore casinos. It’s not flawless — the bonus wagering could be lower — but overall I’m still using it.
I’ve been playing on Craybet for about two months now and thought I’d throw out some thoughts since I haven’t seen many posts about this place around here. Signed up randomly one night and registration literally took 90 seconds. Min deposit was ten bucks which is about what you’d expect. Got a sign-up bonus — 100 percent match to $500 plus 50 free spins on Sweet Bonanza. Wagering was 35 times the bonus which isn’t amazing but not the worst I’ve seen.
The game library is decent honestly. You’ll find stuff from Pragmatic Play, NetEnt, plus Play’n GO — so like Gates of Olympus, Gonzo’s Quest, that kind of thing. I’d guess maybe 1500-2000 slots including table games. Live casino runs on Evolution which is smooth — tried baccarat and Crazy Time with actual croupiers and zero lag issues.
Now the one thing I wasn’t thrilled about was how long cashouts take. Tried cashing out with Visa and it took like a day and a half for my first withdrawal. Once you’re verified though it dropped to like 24 hours. You can use Visa, Mastercard, Skrill, Neteller, Bitcoin which is most bases. I’d check out the full bonus details on CrayBet to see for yourself.
Using Craybet on mobile was surprisingly good. There’s no app to download — the mobile site runs well and everything works fine. I played a few sessions on the bus and didn’t notice any problems.
Support at Craybet has been okay — live chat and someone actually responds in under five minutes when I’ve used it. I contacted them about a bonus that didn’t credit and it was resolved pretty quickly. I think they’re Curacao-based from what I can tell which is what most platforms like this. Not everything is amazing — the bonus wagering could be lower — but overall I’m still using it.
I’ve been messing around on Craybet for roughly two months now and wanted to share some thoughts since there isn’t a ton of talk about this place in this forum. I signed up after seeing an ad and registration was like two minutes. Starting deposit was $10 which is pretty standard. I grabbed a sign-up bonus — matched my first deposit 100% up to 500 plus 50 free spins on Gates of Olympus. Playthrough requirements were 35x and that could be lower but it’s manageable.
Game selection is decent honestly. There’s games from Pragmatic Play, Betsoft, plus Microgaming — meaning Gates of Olympus, Gonzo’s Quest, that kind of thing. I’d guess maybe a couple thousand titles when you add it all up. The live dealer section is powered by Evolution which is legit — tried roulette and Lightning Roulette with actual croupiers and had no complaints.
Now the one thing that kinda bugged me was how long cashouts take. Tried cashing out with Bitcoin and waited about 48 hours the first time. Second time around it dropped to like 24 hours. You can use Visa, Mastercard, e-wallets like Skrill and Neteller, and BTC which covers most bases. You can check out their current offers over at Craybet to see for yourself.
Mobile experience on Craybet on mobile worked better than expected. No dedicated app — the mobile site loads fast and slots and live games work without issues. Played Book of Dead in bed and had zero lag or glitches.
Customer service on Craybet has been decent — they have live chat that gets you a person in under five minutes most times. Had to ask about my verification docs and got it fixed same day. Not sure about Curacao-based from what I can tell and that’s what most platforms like this. Wouldn’t say it’s perfect — promo codes seem rare — but for what it is it does the job for me.