Advertisement
verygoodplugins

Untitled

Jul 13th, 2022
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. add_action( 'wp_login', function( $user_login, $user ) {
  2.  
  3.     if ( ! did_action( 'wpf_user_created' ) ) { // only if the user wasn't just registered and auto-logged in.
  4.         wp_fusion()->user->user_register( $user->ID );
  5.     } else {
  6.  
  7.         $data = array(
  8.             'last_active' => 'X';
  9.         );
  10.  
  11.         wp_fusion()->user->push_user_meta( $user_id, $data );
  12.  
  13.     }
  14.  
  15. }, 10, 2 );
  16.  
  17. add_filter( 'wpf_user_register', function( $user_meta, $user_id ) {
  18.  
  19.     $extra_data = array(
  20.         'last_active' => 'X',
  21.         'user_id'     => $user_id,
  22.         // lastname, firstname, and email are already synced by default, you don't need it;
  23.     );
  24.  
  25.     $user_meta = array_merge( $user_meta, $extra_data );
  26.  
  27.     return $user_meta;
  28.  
  29. }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement