Advertisement
iamdangavin

Save Function

Aug 20th, 2011
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1.     function save_profile_data(){
  2.         if( $profile = $this->input->post('profile') ){
  3.                 $user = $this->input->post('user_id');
  4.                 $user = get_userdata($user);
  5.                 $profile = $this->data_model->add_profile_meta($profile);
  6.                
  7.                 if(isset($_FILES['member_photo']) && !empty($_FILES['member_photo']['name'] ) ){
  8.                     $overrides = array( 'test_form' => false);
  9.                     $file=wp_handle_upload($_FILES['member_photo'], $overrides);
  10.                     $filename = $file['file'];
  11.                     $attachment_id = $this->add_attachment($filename);
  12.                     update_user_meta($user->ID, 'member_photo', $attachment_id );
  13.                 }
  14.                    
  15.                 if(isset($_FILES['company_logo']) && !empty( $_FILES['company_logo']['name'] ) ){
  16.                     $overrides = array( 'test_form' => false);
  17.                     $file=wp_handle_upload($_FILES['company_logo'], $overrides);
  18.                     $filename = $file['file'];
  19.                     $attachment_id = $this->add_attachment($filename);
  20.                     update_user_meta($user->ID, 'company_logo', $attachment_id );
  21.                 }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement