0

I have a php template file created by this Front End Reset Password plugins. Here is original part of the template I would like to acheive:

$reset_url = som_get_lost_password_url() . "?somresetpass=true&action=rp&key=$key&login=" . rawurlencode($user_login);

$message = __( 'Someone requested that the password be reset for the following account:', 'frontend-reset-password' ) . "<br><br>";
$message .= sprintf( __( 'Username: %s', 'frontend-reset-password' ), $user_login ) . "<br><br>";
$message .= home_url( '/' ) . "<br><br>";
$message .= __( 'If this was a mistake, just ignore this email and nothing will happen.', 'frontend-reset-password' ) . "<br><br>";
$message .= __( 'To reset your password, visit the following address:', 'frontend-reset-password' ) . "<br><br>";
//$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";

// replace PAGE_ID with reset page ID $_GET['somresetpass']
$message .= $reset_url;

Here is what I try to achieve:

$reset_url = som_get_lost_password_url() . "?somresetpass=true&action=rp&key=$key&login=" . rawurlencode($user_login);

$message = __( 'Someone requested that the password be reset for the following account:', 'frontend-reset-password' ) . "<br><br>";
$message .= sprintf( __( 'Username: %s', 'frontend-reset-password' ), $user_login ) . "<br><br>";
$message .= home_url( '/' ) . "<br><br>";
$message .= __( 'If this was a mistake, just ignore this email and nothing will happen.', 'frontend-reset-password' ) . "<br><br>";
$message .= __( 'To reset your password, visit the following address:', 'frontend-reset-password' ) . "<br><br>";
//$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";

// replace PAGE_ID with reset page ID $_GET['somresetpass']
$message .= sprintf(__( '<a href="$reset_url">Reset Your Password</a>', 'frontend-reset-password' ) );

I have change the last line to make it URL, but it is not clickable in an email when this message is sent to users after they submit a Password Reset form.

How can I make it clickable in an email?

daro2013
  • 33
  • 2
  • 8
  • 1
    Your `$reset_url ` won't be parsed, since the whole string is in single quotes. Switch your quotes around so the string itself is in double quotes and the url is in single quotes. – aynber May 25 '18 at 19:47
  • 1
    Possible duplicate of [What is the difference between single-quoted and double-quoted strings in PHP?](https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php) – aynber May 25 '18 at 19:47
  • anynber, many thanks. I just did what you say like this: – daro2013 May 25 '18 at 19:55

1 Answers1

0

many thanks, aynber. It works well; I just did what you say like this:

$message .= sprintf(__( "<a href='$reset_url'>Reset Your Password</a>", 'frontend-reset-password' ) );

May I ask another question for the same function? I try to figure out how to send the above link based on languages to users after they submit a Password Reset form. I use Polylang built-in theme, and could not separate in this way:

if (get_locale() == "en_US") {
//send the codes above
}
else {
//send message above in French and change this URL to: home_url()/fr/ ..?
}

Because the above default URL does not separate between home URL and its page; is it possible to achieve that?

Thanks

daro2013
  • 33
  • 2
  • 8
  • You ought to ask that as another question, instead of tacking it on. I'm not sure of the answer to this. – aynber May 25 '18 at 20:28