Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Add extra user settings
- function user_interests_fields( $user ) {
- if(!current_user_can( 'edit_user', $user->ID ) )
- return false;
- $is_gamer = get_the_author_meta( 'is_gamer', $user->ID ); ?>
- <h3><?php _e('Extra Settings', 'dp'); ?></h3>
- <table class="form-table">
- <tr>
- <th><?php _e('Is gamer?', 'dp'); ?></th>
- <td>
- <label for="user_interests_<?php echo esc_attr( $tag->slug); ?>">
- <input id="is_gamer" name="is_gamer" type="checkbox" value="1" <?php if($is_gamer) echo ' checked="checked"'; ?> />
- <?php _e('Check this if this user is a gamer.', 'dp'); ?>
- </label>
- </td>
- </tr>
- </table>
- $is_team = get_the_author_meta( 'is_team', $team->ID ); ?>
- <table class="form-table">
- <tr>
- <th><?php _e('Is team?', 'dp'); ?></th>
- <td>
- <label for="user_interests_<?php echo esc_attr( $tag->slug); ?>">
- <input id="is_team" name="is_team" type="checkbox" value="1" <?php if($is_team) echo ' checked="checked"'; ?> />
- <?php _e('Check this if this user is a team.', 'dp'); ?>
- </label>
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'show_user_profile', 'user_interests_fields' );
- add_action( 'edit_user_profile', 'user_interests_fields' );
- // Store extra user settings
- function user_interests_fields_save( $user_id ) {
- if(!current_user_can( 'edit_user', $user_id ) )
- return false;
- update_user_meta( $user_id, 'is_gamer', $_POST['is_gamer'] );
- update_user_meta( $user_id, 'is_team', $_POST['is_team'] );
- }
- add_action( 'personal_options_update', 'user_interests_fields_save' );
- add_action( 'edit_user_profile_update', 'user_interests_fields_save' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement