Advertisement
Guest User

sasa

a guest
Dec 7th, 2010
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1.  
  2. add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
  3. add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
  4.  
  5. function my_show_extra_profile_fields( $user ) { ?>
  6.  
  7.  <h3>Adsense Informacije</h3>
  8.  
  9.  <table class="form-table">
  10.  
  11.   <tr>
  12.    <th><label for="adsense_336">Adsense 300x250</label></th>
  13.  
  14.    <td>
  15.     <textarea rows="10" cols="60" name="adsense_336" id="adsense_336" class="regular-text" value="<?php echo esc_attr( get_the_author_meta( 'adsense_336', $user->ID ) ); ?>" ></textarea><br />
  16.     <span class="description">Unesite vas Adsense kod ovde 300x250</span>
  17.    </td>
  18.   </tr>
  19.  
  20.    <tr>
  21.    <th><label for="adsense_2">Adsense 200x90</label></th>
  22.  
  23.    <td>
  24.     <textarea rows="10" cols="60" name="adsense_2" id="adsense_2" class="regular-text" value="<?php echo esc_attr( get_the_author_meta( 'adsense_2', $user->ID ) ); ?>" ></textarea><br />
  25.     <span class="description">Unesite vas Adsense kod ovde 200x90</span>
  26.    </td>
  27.   </tr>
  28.  
  29.  </table>
  30. <?php }
  31.  
  32. add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
  33. add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
  34.  
  35. function my_save_extra_profile_fields( $user_id ) {
  36.   $saved = false;
  37.   if ( current_user_can( 'edit_user', $user_id ) ) {
  38.  update_user_meta( $user_id, 'adsense_336', $_POST['adsense_336'] );
  39.  update_user_meta( $user_id, 'adsense_2', $_POST['adsense_2'] );
  40.      $saved = true;
  41.   }
  42.     return true;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement