From 5d4eb539c1dba5dfb2bbf11645806ca5b97504e5 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Fri, 11 Feb 2022 13:23:23 +0200 Subject: [PATCH] - fixed PHP warning when there aren't proper user while login; --- includes/core/um-actions-login.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/core/um-actions-login.php b/includes/core/um-actions-login.php index ce83d2b3..ec19ca6f 100644 --- a/includes/core/um-actions-login.php +++ b/includes/core/um-actions-login.php @@ -164,12 +164,15 @@ add_action( 'um_on_login_before_redirect', 'um_store_lastlogin_timestamp', 10, 1 */ function um_store_lastlogin_timestamp_( $login ) { $user = get_user_by( 'login', $login ); - um_store_lastlogin_timestamp( $user->ID ); - $attempts = (int) get_user_meta( $user->ID, 'password_rst_attempts', true ); - if ( $attempts ) { - //don't create meta but update if it's exists only - update_user_meta( $user->ID, 'password_rst_attempts', 0 ); + if ( false !== $user ) { + um_store_lastlogin_timestamp( $user->ID ); + + $attempts = (int) get_user_meta( $user->ID, 'password_rst_attempts', true ); + if ( $attempts ) { + //don't create meta but update if it's exists only + update_user_meta( $user->ID, 'password_rst_attempts', 0 ); + } } } add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );