We are using Gravity forms and memberpress. When a user signs up in gravity forms, they need to wait for us to approve them. Once they are approved they are emailed a link to setup their password. However, gravity forms in sending these users a link to the Wordpress login page - not the memberpress login page. How do we change the url in the email to send to the memberpress login page?
This is the password reset email that is sent:
Memberpress support gave us this code to solve this issue inside of memberpress. It solved it for all memberpress related emails:
add_filter( 'retrieve_password_message', function( $message, $key, $user_login, $user_data ) {
$user = new MeprUser($user_data->ID);
$link = $user->reset_password_link();
// Start with the default content.
$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n";
/* translators: %s: site name */
$message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n";
/* translators: %s: user login */
$message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";
$message .= __( 'If this was a mistake, just ignore this email and nothing will happen.' ) . "\r\n\r\n";
$message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n";
$message .= $link . "\r\n";
// Return the filtered message.
return $message;
}, 10, 4);
We contacted gravity forms and this was the reply from support:
- Use the following filter which runs when the user is activated to adapt the code provided by MemberPress support and send the email using WordPress core wp_mail() function:
However, I am unclear on how to implement the filter.
We added the following additional snippet to our website:
add_action( 'gform_activate_user', 'wp_mail', 10, 3 );
wp_mail( $to, $subject, $message, $headers, $attachments );
However, that was not successful. Any additional guidance on this would be appreciated.
How do we get the email password reset link to reset the user’s memberpress login and not redirect to the wordpress login? Thanks!