Advertisement
tcelestino

Add field textarea module Users

Oct 26th, 2011
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. add_action( 'show_user_profile', 'show_profile_fields' );
  2. add_action( 'edit_user_profile', 'show_profile_fields' );
  3.  
  4. function show_profile_fields( $user ) { ?>
  5.  
  6. <h3><?php _e("More Information") ?></h3>
  7.  
  8. <table class="form-table">
  9.  
  10. <tr>
  11. <th><?php _e("Research Interests:"); ?></th>
  12.  
  13. <td>
  14.  
  15.  
  16. <textarea name="interests" id="interests" class="regular-text" cols="30" rows="5">
  17. <?php echo esc_html(get_the_author_meta('interests', $user->ID) ); ?>
  18. </textarea><br />
  19. <span class="description"><?php _e("Enter your Research Interests. Separate with commas"); ?></span>
  20.  
  21.  
  22.  
  23. </td>
  24. </tr>
  25.  
  26. </table>
  27. <?php }
  28.  
  29. add_action( 'personal_options_update', 'save_profile_fields' );
  30. add_action( 'edit_user_profile_update', 'save_profile_fields' );
  31.  
  32. function save_profile_fields( $user_id ) {
  33.  
  34. if ( !current_user_can( 'edit_user', $user_id ) )
  35. return false;
  36.  
  37. update_usermeta( $user_id, 'interests', $_POST['interests'] );
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement