mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-18 04:25:07 +00:00
Make it much easier to filter contact methods from user profiles adding and removing at will. Fixes #10240 props joostdevalk.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
07c88e581e
commit
8aa2598b6a
@ -105,12 +105,11 @@ function edit_user( $user_id = 0 ) {
|
|||||||
$user->display_name = esc_html( trim( $_POST['display_name'] ));
|
$user->display_name = esc_html( trim( $_POST['display_name'] ));
|
||||||
if ( isset( $_POST['description'] ))
|
if ( isset( $_POST['description'] ))
|
||||||
$user->description = trim( $_POST['description'] );
|
$user->description = trim( $_POST['description'] );
|
||||||
if ( isset( $_POST['jabber'] ))
|
$user_contactmethods = _wp_get_user_contactmethods();
|
||||||
$user->jabber = esc_html( trim( $_POST['jabber'] ));
|
foreach ($user_contactmethods as $method => $name) {
|
||||||
if ( isset( $_POST['aim'] ))
|
if ( isset( $_POST[$method] ))
|
||||||
$user->aim = esc_html( trim( $_POST['aim'] ));
|
$user->$method = esc_html( trim( $_POST[$method] ) );
|
||||||
if ( isset( $_POST['yim'] ))
|
}
|
||||||
$user->yim = esc_html( trim( $_POST['yim'] ));
|
|
||||||
if ( !$update )
|
if ( !$update )
|
||||||
$user->rich_editing = 'true'; // Default to true for new users.
|
$user->rich_editing = 'true'; // Default to true for new users.
|
||||||
else if ( isset( $_POST['rich_editing'] ) )
|
else if ( isset( $_POST['rich_editing'] ) )
|
||||||
@ -378,9 +377,12 @@ function get_user_to_edit( $user_id ) {
|
|||||||
$user->last_name = esc_attr($user->last_name);
|
$user->last_name = esc_attr($user->last_name);
|
||||||
$user->display_name = esc_attr($user->display_name);
|
$user->display_name = esc_attr($user->display_name);
|
||||||
$user->nickname = esc_attr($user->nickname);
|
$user->nickname = esc_attr($user->nickname);
|
||||||
$user->aim = isset( $user->aim ) && !empty( $user->aim ) ? esc_attr($user->aim) : '';
|
|
||||||
$user->yim = isset( $user->yim ) && !empty( $user->yim ) ? esc_attr($user->yim) : '';
|
$user_contactmethods = _wp_get_user_contactmethods();
|
||||||
$user->jabber = isset( $user->jabber ) && !empty( $user->jabber ) ? esc_attr($user->jabber) : '';
|
foreach ($user_contactmethods as $method => $name) {
|
||||||
|
$user->{$method} = isset( $user->{$method} ) && !empty( $user->{$method} ) ? esc_attr($user->{$method}) : '';
|
||||||
|
}
|
||||||
|
|
||||||
$user->description = isset( $user->description ) && !empty( $user->description ) ? esc_html($user->description) : '';
|
$user->description = isset( $user->description ) && !empty( $user->description ) ? esc_html($user->description) : '';
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
@ -835,4 +837,21 @@ function default_password_nag() {
|
|||||||
echo '</p></div>';
|
echo '</p></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the default contact methods
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @since
|
||||||
|
*
|
||||||
|
* @return array $user_contactmethods Array of contact methods and their labels.
|
||||||
|
*/
|
||||||
|
function _wp_get_user_contactmethods() {
|
||||||
|
$user_contactmethods = array(
|
||||||
|
'aim' => __('AIM'),
|
||||||
|
'yim' => __('Yahoo IM'),
|
||||||
|
'jabber' => __('Jabber / Google Talk')
|
||||||
|
);
|
||||||
|
return apply_filters('user_contactmethods',$user_contactmethods);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -267,20 +267,16 @@ else
|
|||||||
<td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
|
<td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach (_wp_get_user_contactmethods() as $name => $desc) {
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="aim"><?php echo apply_filters('user_aim_label', __('AIM')); ?></label></th>
|
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
||||||
<td><input type="text" name="aim" id="aim" value="<?php echo esc_attr($profileuser->aim) ?>" class="regular-text" /></td>
|
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php
|
||||||
<tr>
|
}
|
||||||
<th><label for="yim"><?php echo apply_filters('user_yim_label', __('Yahoo IM')); ?></label></th>
|
?>
|
||||||
<td><input type="text" name="yim" id="yim" value="<?php echo esc_attr($profileuser->yim) ?>" class="regular-text" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th><label for="jabber"><?php echo apply_filters('user_jabber_label', __('Jabber / Google Talk')); ?></label></th>
|
|
||||||
<td><input type="text" name="jabber" id="jabber" value="<?php echo esc_attr($profileuser->jabber) ?>" class="regular-text" /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
|
<h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
|
||||||
|
@ -164,15 +164,6 @@ function wp_insert_user($userdata) {
|
|||||||
if ( empty($use_ssl) )
|
if ( empty($use_ssl) )
|
||||||
$use_ssl = 0;
|
$use_ssl = 0;
|
||||||
|
|
||||||
if ( empty($jabber) )
|
|
||||||
$jabber = '';
|
|
||||||
|
|
||||||
if ( empty($aim) )
|
|
||||||
$aim = '';
|
|
||||||
|
|
||||||
if ( empty($yim) )
|
|
||||||
$yim = '';
|
|
||||||
|
|
||||||
if ( empty($user_registered) )
|
if ( empty($user_registered) )
|
||||||
$user_registered = gmdate('Y-m-d H:i:s');
|
$user_registered = gmdate('Y-m-d H:i:s');
|
||||||
|
|
||||||
@ -203,13 +194,16 @@ function wp_insert_user($userdata) {
|
|||||||
update_usermeta( $user_id, 'last_name', $last_name);
|
update_usermeta( $user_id, 'last_name', $last_name);
|
||||||
update_usermeta( $user_id, 'nickname', $nickname );
|
update_usermeta( $user_id, 'nickname', $nickname );
|
||||||
update_usermeta( $user_id, 'description', $description );
|
update_usermeta( $user_id, 'description', $description );
|
||||||
update_usermeta( $user_id, 'jabber', $jabber );
|
|
||||||
update_usermeta( $user_id, 'aim', $aim );
|
|
||||||
update_usermeta( $user_id, 'yim', $yim );
|
|
||||||
update_usermeta( $user_id, 'rich_editing', $rich_editing);
|
update_usermeta( $user_id, 'rich_editing', $rich_editing);
|
||||||
update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts);
|
update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts);
|
||||||
update_usermeta( $user_id, 'admin_color', $admin_color);
|
update_usermeta( $user_id, 'admin_color', $admin_color);
|
||||||
update_usermeta( $user_id, 'use_ssl', $use_ssl);
|
update_usermeta( $user_id, 'use_ssl', $use_ssl);
|
||||||
|
foreach (_wp_get_user_contactmethods() as $method => $name) {
|
||||||
|
if ( empty($$method) )
|
||||||
|
$$method = '';
|
||||||
|
|
||||||
|
update_usermeta( $user_id, $method, $$method );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset($role) ) {
|
if ( isset($role) ) {
|
||||||
$user = new WP_User($user_id);
|
$user = new WP_User($user_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user