MC4WP_User_Integration

Class MC4WP_User_Integration.

Defined (1)

The class is defined in the following location(s).

/includes/integrations/class-user-integration.php  
  1. abstract class MC4WP_User_Integration extends MC4WP_Integration { 
  2.  
  3. /** 
  4. * @param WP_User $user 
  5. * @return array 
  6. */ 
  7. protected function user_merge_vars( WP_User $user ) { 
  8.  
  9. // start with user_login as name, since that's always known 
  10. $merge_vars = array( 
  11. 'NAME' => $user->user_login,  
  12. ); 
  13.  
  14. if( '' !== $user->first_name ) { 
  15. $merge_vars['NAME'] = $user->first_name; 
  16. $merge_vars['FNAME'] = $user->first_name; 
  17.  
  18. if( '' !== $user->last_name ) { 
  19. $merge_vars['LNAME'] = $user->last_name; 
  20.  
  21. if( '' !== $user->first_name && '' !== $user->last_name ) { 
  22. $merge_vars['NAME'] = sprintf( '%s %s', $user->first_name, $user->last_name ); 
  23.  
  24. /** 
  25. * @filter `mc4wp_user_merge_vars` 
  26. * @expects array 
  27. * @param array $merge_vars 
  28. * @param WP_User $user 
  29. * Use this to filter the merge vars of a user 
  30. */ 
  31. $merge_vars = (array) apply_filters( 'mc4wp_user_merge_vars', $merge_vars, $user ); 
  32.  
  33. return $merge_vars; 
  34.