Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code to add Last Login to Profile Builder.
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
You can’t perform that action at this time.