Advertisement
mgunnin

custom-original.php

Dec 9th, 2012
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php
  2.  
  3. // Add extra user settings
  4. function user_interests_fields( $user ) {
  5. if(!current_user_can( 'edit_user', $user->ID ) )
  6. return false;
  7.  
  8. $is_gamer = get_the_author_meta( 'is_gamer', $user->ID ); ?>
  9. <h3><?php _e('Extra Settings', 'dp'); ?></h3>
  10. <table class="form-table">
  11. <tr>
  12. <th><?php _e('Is gamer?', 'dp'); ?></th>
  13. <td>
  14. <label for="user_interests_<?php echo esc_attr( $tag->slug); ?>">
  15. <input id="is_gamer" name="is_gamer" type="checkbox" value="1" <?php if($is_gamer) echo ' checked="checked"'; ?> />
  16. <?php _e('Check this if this user is a gamer.', 'dp'); ?>
  17. </label>
  18. </td>
  19. </tr>
  20. </table>
  21. <?php }
  22. add_action( 'show_user_profile', 'user_interests_fields' );
  23. add_action( 'edit_user_profile', 'user_interests_fields' );
  24.  
  25. // Store extra user settings
  26. function user_interests_fields_save( $user_id ) {
  27. if(!current_user_can( 'edit_user', $user_id ) )
  28. return false;
  29.  
  30. update_user_meta( $user_id, 'is_gamer', $_POST['is_gamer'] );
  31. }
  32. add_action( 'personal_options_update', 'user_interests_fields_save' );
  33. add_action( 'edit_user_profile_update', 'user_interests_fields_save' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement