Changeset 4534 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/partials/register-profilefields.php
- Timestamp:
- 12/15/2016 06:33:13 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/partials/register-profilefields.php
r4470 r4534 4 4 * 5 5 * This template expects that the global $user variable is set. 6 * This template also handles saving of the fields, not ideal, but does the job for now.7 6 * 8 7 * @package wporg-login … … 10 9 11 10 $fields = array( 12 'url' => '',13 'from' => '',14 'occ' => '',15 'interests' => '',11 'url' => wp_get_current_user()->user_url ?: '', 12 'from' => get_user_meta( get_current_user_id(), 'from', true ) ?: '', 13 'occ' => get_user_meta( get_current_user_id(), 'occ', true ) ?: '', 14 'interests' => get_user_meta( get_current_user_id(), 'interests', true ) ?: '', 16 15 ); 17 18 foreach ( array_keys( $fields ) as $field ) {19 if ( $_POST && isset( $_POST['user_fields'][ $field ] ) ) {20 $fields[ $field ] = sanitize_text_field( wp_unslash( $_POST['user_fields'][ $field ] ) );21 if ( 'url' == $field ) {22 wp_update_user( array(23 'ID' => get_current_user_id(),24 'user_url' => esc_url( $fields[ $field ] )25 ) );26 } else {27 update_user_meta( $user->ID, $field, $fields[ $field ] );28 }29 } else {30 $fields[ $field ] = ( 'url' === $field ) ? $user->user_url : get_user_meta( $user->ID, $field, true );31 }32 }33 16 34 17 ?>
Note: See TracChangeset
for help on using the changeset viewer.