Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* add an extra field to users to check if they registered */
- function defunktnu_add_custom_user_profile_fields($user) {
- ?>
- <h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
- <table class="form-table">
- <tr>
- <th>
- <label for="address"><?php _e('Address', 'your_textdomain'); ?>
- </label></th>
- <td>
- <input type="text" name="address" id="address" value="<?php echo esc_attr( get_user_meta( $user->ID, 'address', true) ); ?>" class="regular-text" /><br />
- <span class="description"><?php _e('Please enter your address.', 'your_textdomain'); ?></span>
- </td>
- </tr>
- <tr>
- <th>
- <label for="address"><?php _e('Al geregistreerd', 'your_textdomain'); ?>
- </label></th>
- <td>
- <?php
- $checked == "";
- if(get_user_meta( $user->ID, 'registered', true) == "Ja") {
- $checked = " checked=\"checked\"";
- }
- ?>
- <input type="checkbox" name="registered"<?=$checked?> id="registered" value="Ja" class="regular-text" /><br />
- </td>
- </tr>
- </table>
- <?php }
- function fb_save_custom_user_profile_fields( $user_id ) {
- if ( !current_user_can( 'edit_user', $user_id ) )
- return FALSE;
- //echo("*" . $_POST['registered']);exit();
- update_usermeta( $user_id, 'address', $_POST['address'] );
- update_usermeta( $user_id, 'registered', $_POST['registered'] );
- }
- add_action( 'show_user_profile', 'defunktnu_add_custom_user_profile_fields' );
- add_action( 'edit_user_profile', 'defunktnu_add_custom_user_profile_fields' );
- add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
- add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement