- fixed PHP warning when there aren't proper user while login;

This commit is contained in:
Nikita Sinelnikov
2022-02-11 13:23:23 +02:00
parent b7f4be7137
commit 5d4eb539c1
+8 -5
View File
@@ -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_' );