Created
February 16, 2022 16:55
-
-
Save wpmudev-sls/ac0844c469b71231e8518a5818803d75 to your computer and use it in GitHub Desktop.
After activating the user, redirects to the reset user password WP default page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: [Forminator] Reset User Password | |
* Plugin URI: https://wpmudev.com | |
* Description: After activating the user, redirects to the reset user password WP default page. | |
* Author: Glauber Silva @ WPMUDEV | |
* Author URI: https://wpmudev.com | |
* Jira Task: SLS-3313 | |
* License: GPLv2 or later | |
* | |
* @package WPMUDEV_Forminator_Reset_User_Password | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
function wpmudev_forminator_reset_user_password( $user_id, $signup_meta ) { | |
if ( ! is_admin() ) { | |
$user = get_userdata( $user_id ); | |
$key = get_password_reset_key( $user ); | |
$url = esc_url_raw( untrailingslashit( wp_login_url() ) . "?action=rp&key=$key&login=" . rawurlencode( $user->user_login ) ); | |
wp_redirect( $url ); | |
exit(); | |
} | |
} | |
add_action( 'forminator_activate_user', 'wpmudev_forminator_reset_user_password', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment