Skip Navigation

[Closed] Custom notification body – Reset password link

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 8 replies, has 3 voices.

Last updated by Shane 4 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1717397

Hi, I need to customize the body of a form notification. I wanto to send to the user the reset password link I generate with this code:

$user = get_user_by('id', $user_id);
$user_login = $user->user_login;
$reset_key = get_password_reset_key( $user );

$reset_link = '<a href="' . wp_login_url()."/resetpass/?key=$reset_key &login=" . rawurlencode($user_login) . '">reset your password</a>';

How can I use the customise_cred_notifications hook to do it?

The current %%RESET_PASSWORD_LINK%% placeholder of Forms notifications is a simple link to the lost password page, it isn't a reset link.

It would be great if you create a palceholder for the reset password link in the Forms notification, it would work great as an account activation email.

thanks

#1717573

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Umberto,

Thank you for getting in touch.

Unfortunately the reset password option is completely generated by wordpress core so you wont be able to use our forms hook to modify this.

The function that can help with this is the retrieve_password_message hook from wordpress.

I would recommend taking a look at the link below for further assistance on this.
https://toolset.com/forums/topic/customize-reset-password-email/#post-1375265

Thanks,
Shane

#1717997

Hi Shane, thanks for your answer, but I don't' need to customize the retrieve password message. What I need is to customize the message of a Tooflset Forms notification. I saw examples how to customize notificaion's 'headers' by customise_cred_notifications, but I'm not sure if I can use the same hook to customize the 'message' of the notification. Can you help me?

#1719701

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Umberto,

What you mention in your initial post is a little contradictory because if you are triggering the reset password notification, then our Forms hook will not work for this because the reset password email comes directly from wordpress.

"The current %%RESET_PASSWORD_LINK%% placeholder of Forms notifications is a simple link to the lost password page, it isn't a reset link."

This is what wordpress actually generates, it resets the password by sending you to the lost password page then it emails you a link in order to reset that password.

However the hook to customize the mail headers from our Form's notifications is below.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_mail_header

Thanks,
Shane

#1723185

Hi Shane, can I customize the notification Body message with cred_mail_header hook? Can you show me an example?

thanks

#1723887

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Umberto,

I took another look at this for you and this hook is only for the message headers, unfortunately the actual message is not apart of the header.

What I recommend is that you use a custom placeholder
https://toolset.com/documentation/programmer-reference/forms/how-to-use-custom-placeholders-in-cred-notifications/

You can create your code as a custom placeholder then build your notification in your form then add the placeholder to where you want to have your generate message.

Thanks,
Shane

#1729639

Hi, I checked the custom placeholder documentation, but here the problem is that I need to create the reset key with this function:

$user = get_user_by('id', $user_id);
$reset_key = get_password_reset_key( $user );

I can't use it in the custom placeholder add_filter because $user is still not created. I can do it only after form submission.

Do you see any other way to customize the notification message?

#1729931

Hi, Shane is out today on a public holiday and will return tomorrow to continue assisting you. Thanks for your patience.

#1731155

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Umberto,

Then unfortunately not, our hook doesn't allow you to modify the message itself only the headers.

However not sure why you're not able to use the custom placeholder since the message is triggered after the form has been submitted.

What happens when you try using the custom placeholder?

Please let me know.
Thanks,
Shane

The topic ‘[Closed] Custom notification body – Reset password link’ is closed to new replies.