Don't like ads? PRO users don't see any ads ;-)
Guest

Käyttäjäprofiiliin osoitetietojen lisäys

By: samikeijonen on Jan 25th, 2012  |  syntax: PHP  |  size: 1.49 KB  |  hits: 68  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php  
  2.         /* Lisää käyttäjän sivulle osoitetiedot. http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields.
  3.         *  Huom! Funktio update_usermeta on vanhentunut, käytä funktiota update_user_meta.
  4.         */
  5.         add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
  6.         add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
  7.  
  8. /* Osoitetiedot käyttäjät-sivulle */
  9. function my_show_extra_profile_fields( $user ) {
  10. ?>
  11.  
  12.         <h3>Osoitetiedot</h3>
  13.  
  14.         <table class="form-table">
  15.  
  16.                 <tr>
  17.                         <th><label for="osoite">Osoite</label></th>
  18.  
  19.                         <td>
  20.                                 <input type="text" name="osoite" id="osoite" value="<?php echo  esc_attr( get_user_meta( $user->ID, 'osoite', true ) ) ; ?>" class="regular-text" /><br />
  21.                                 <span class="description">Osoite.</span>
  22.                         </td>
  23.                 </tr>
  24.                
  25.                 <tr>
  26.                         <th><label for="postinumero">Postinumero</label></th>
  27.  
  28.                         <td>
  29.                                 <input type="text" name="postinumero" id="postinumero" value="<?php echo esc_attr( get_user_meta( $user->ID, 'postinumero', true ) ) ; ?>" class="regular-text" /><br />
  30.                                 <span class="description">Postinumero.</span>
  31.                         </td>
  32.                 </tr>
  33.                
  34.                 <tr>
  35.                         <th><label for="postitoimipaikka">Postitoimipaikka</label></th>
  36.  
  37.                         <td>
  38.                                 <input type="text" name="postitoimipaikka" id="postitoimipaikka" value="<?php echo esc_attr( get_user_meta( $user->ID, 'postitoimipaikka', true ) ) ; ?>" class="regular-text" /><br />
  39.                                 <span class="description">Postitoimipaikka.</span>
  40.                         </td>
  41.                 </tr>
  42.  
  43.         </table>
  44. <?php }