Created
August 13, 2018 10:12
-
-
Save zjbennett/945c23dc61bf8fd4bbeae705b89b322c to your computer and use it in GitHub Desktop.
Code to add Last Login to Profile Builder.
This file contains 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
function wppbc_save_user_last_login( $login = '' ) { | |
if( empty( $login ) ) | |
return; | |
$user = get_user_by( 'login', $login ); | |
$now = date('Y-m-d H:i:s'); | |
update_user_meta( $user->ID, 'last_login', $now ); | |
} | |
add_action( 'wp_login', 'wppbc_save_user_last_login', 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment