mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-13 19:56:27 +09:00
Enhance password reset logic and add Action Scheduler filter
Ensure proper handling of user data in password reset functions by adding checks and updating parameter handling. Introduce a new filter to extend site health information and include a setting for enabling email sending via Action Scheduler. Improve code clarity with updated comments and function annotations.
This commit is contained in:
@@ -1484,22 +1484,27 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return get_password_reset_key( $userdata );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Password reset email
|
||||
*
|
||||
* @param int|null $user_id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function password_reset() {
|
||||
$userdata = get_userdata( um_user( 'ID' ) );
|
||||
public function password_reset( $user_id = null ) {
|
||||
if ( is_null( $user_id ) ) {
|
||||
$user_id = um_user( 'ID' );
|
||||
}
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
$this->maybe_generate_password_reset_key( $userdata );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ) );
|
||||
|
||||
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'resetpw_email', array( 'fetch_user_id' => um_user( 'ID' ) ) ) );
|
||||
UM()->maybe_action_scheduler()->enqueue_async_action( 'um_dispatch_email', array( $userdata->user_email, 'resetpw_email', array( 'fetch_user_id' => $user_id ) ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Password changed email
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user