Advertisement
Beee

Store s2 custom fields

May 11th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. // Populating custom fields after registration
  2. function ch_s2_registration_field_population() {
  3.  
  4.     global $current_user;
  5.     get_currentuserinfo();
  6.    
  7.     // Do only at the first login of the user
  8.     // if ( get_user_field('s2member_login_counter') < 2) {
  9.    
  10.         $s2user_country = get_user_field( 'user_country' );
  11.         $um_country         = get_user_meta( $current_user->ID, 'user_country', true );
  12.        
  13.         if ( $um_country == '' && $s2user_country != '' ) {
  14.         update_user_meta( $current_user->ID, 'user_country', $s2user_country );
  15.         }
  16.        
  17.     // }
  18.  
  19. }
  20. add_action('wp_head', 'ch_s2_registration_field_population', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement