Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wpmudev-sls/ac0844c469b71231e8518a5818803d75 to your computer and use it in GitHub Desktop.
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.
<?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