Opened 12 years ago
Closed 12 years ago
#1955 closed defect (bug) (fixed)
Bug in form-user-edit.php file.
Reported by: | plescheff | Owned by: | |
---|---|---|---|
Milestone: | 2.2 | Priority: | normal |
Severity: | normal | Version: | 2.1.2 |
Component: | Component - Users | Keywords: | |
Cc: |
Description
Using bbPress 2.1.2, WordPress 3.4.2.
Needed to add some custom contact fields to user profile. User edit form won't show custom contact fields after save.
Steps to reproduce..
Add these lines to functions.php :
add_filter('user_contactmethods', 'ztwp_extra_user_contactmethods');
function ztwp_extra_user_contactmethods() {
return array('phone' => __('Phone'));
}
function ztwp_save_extra_user_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
update_user_meta( $user_id, 'phone', $_POST['phone'] );
}
Open user profile via bbPress. You should see field for phone number. Enter phone no and save. After save you won't see the number prefilled in the field. The number was saved nevertheless (check user profile via wp-admin).
I found and fixed the bug. Please include this in your next releases.
Patch for file wp-content/plugins/bbpress/bbp-theme-compat/bbpress/form-user-edit.php (line 62):
--- <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( bbp_get_displayed_user_field( 'name' ) ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" /> +++ <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( bbp_get_displayed_user_field( $name ) ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" />
(In [4227]) User Edit: