Advertisement
rarescosma

Untitled

Apr 21st, 2011
1,475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. class myUsers {
  2.     static function init() {
  3.         // Change the user's display name after insertion
  4.         add_action( 'user_register', array( __CLASS__, 'change_display_name' ) );  
  5.     }
  6.    
  7.     static function change_display_name( $user_id ) {
  8.         $info = get_userdata( $user_id );
  9.        
  10.         $args = array(
  11.             'ID' => $user_id,
  12.             'display_name' => $info->first_name . ' ' . $info->last_name
  13.         );
  14.        
  15.         wp_update_user( $args ) ;
  16.     }
  17. }
  18.  
  19. myUsers::init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement