Skip to content

Instantly share code, notes, and snippets.

@zjbennett
Created August 13, 2018 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zjbennett/945c23dc61bf8fd4bbeae705b89b322c to your computer and use it in GitHub Desktop.
Save zjbennett/945c23dc61bf8fd4bbeae705b89b322c to your computer and use it in GitHub Desktop.
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