Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
- add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
- function my_show_extra_profile_fields( $user ) { ?>
- <h3>Code Rep Unique</h3>
- <table class="form-table">
- <tr>
- <th><label for="jobpos">Votre Code Rep Unique</label></th>
- <td>
- <input type="text" name="jobpos" id="jobpos" value="<?php echo esc_attr( get_the_author_meta( 'jobpos', $user->ID ) ); ?>" class="regular-text" /><br />
- <span class="description">Ce code est confidentiel et unique pour chacun des reps.</span>
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
- add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
- function my_save_extra_profile_fields( $user_id ) {
- if ( !current_user_can( 'edit_user', $user_id ) )
- return false;
- update_usermeta( $user_id, 'jobpos', $_POST['jobpos'] );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement