Hooks for password reset and reset complete
-
Im trying to add a custom function in “Functions.php” that will send me an email to my admin email address if a member clicks on “Forgot Password?” on the https://www.darwendt.com/customer-area/ page.
This is the code I am trying, but the section doesnt seem to be called as I belive I dont have the correct hook name in the add_action line.
Could anybody possibly point me in the wright direction if this is possible to do.
Regards Andrew….add_action( ‘wpmem_pwd_reset_email_sent’, ‘notify_admin_wpmem_pwreset_requested’, 10, 1 );
function notify_admin_wpmem_pwreset_requested( $user_id ) {
// — START DEBUGGING LINE —
error_log( ‘DEBUG: notify_admin_wpmem_pwreset_requested function triggered for user ID: ‘ . $user_id );
// — END DEBUGGING LINE —$admin_email = 'MY_EMAIL_IS_HERE'; // Your admin email address
$user = get_userdata( $user_id );
if ( ! $user ) {
error_log( 'WP-Members Password Reset Request Notification: User data not found for ID ' . $user_id );
return;
}
$user_login = $user->user_login;
$user_email = $user->user_email;
$subject = 'WP-Members Password Reset Request - EMAIL SENT';
$message = "A WP-Members password reset link was requested and sent to a user:\n\n";
$message .= "Username: $user_login\n";
$message .= "Email: $user_email\n";
$message .= "Time: " . current_time( 'Y-m-d H:i:s' ) . "\n";
$message .= "Site: " . get_bloginfo('name') . "\n";
$message .= "Site URL: " . site_url();
// Send the email
$mail_sent = wp_mail( $admin_email, $subject, $message );
if ( ! $mail_sent ) {
error_log( 'WP-Members Password Reset Request Notification: Failed to send email to ' . $admin_email );
} else {
// --- START DEBUGGING LINE ---
error_log( 'DEBUG: notify_admin_wpmem_pwreset_requested email successfully sent to ' . $admin_email );
// --- END DEBUGGING LINE ---
}}
The topic ‘Hooks for password reset and reset complete’ is closed to new replies.