Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'edit_user_profile', 'show_extra_profile_fields', 10 );
- function show_extra_profile_fields( $user ) { ?>
- <table class="form-table">
- <tr>
- <th><label for="roll"><?php _e('Roll No.', 'frontendprofile'); ?></label></th>
- <td>
- <input type="text" name="roll" id="roll" value="<?php echo esc_attr( get_the_author_meta( 'roll', $user->ID ) ); ?>" class="regular-text" /><br />
- <span class="description"><?php _e('Please enter Roll No.', 'frontendprofile'); ?></span>
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'personal_options_update', 'save_extra_profile_fields' );
- add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );
- function save_extra_profile_fields( $user_id ) {
- if ( !current_user_can( 'edit_user', $user_id ) )
- return false;
- update_usermeta( $user_id, 'roll', $_POST['roll'] );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement