Pass user object through _wp_get_user_contactmethods() to the user_contactmethods filter. props aaroncampbell, fixes #15186.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99a5439b44
commit
f5e23028ff
|
@ -110,7 +110,7 @@ function edit_user( $user_id = 0 ) {
|
||||||
if ( isset( $_POST['description'] ) )
|
if ( isset( $_POST['description'] ) )
|
||||||
$user->description = trim( $_POST['description'] );
|
$user->description = trim( $_POST['description'] );
|
||||||
|
|
||||||
foreach ( _wp_get_user_contactmethods() as $method => $name ) {
|
foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
|
||||||
if ( isset( $_POST[$method] ))
|
if ( isset( $_POST[$method] ))
|
||||||
$user->$method = sanitize_text_field( $_POST[$method] );
|
$user->$method = sanitize_text_field( $_POST[$method] );
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ function get_editable_roles() {
|
||||||
function get_user_to_edit( $user_id ) {
|
function get_user_to_edit( $user_id ) {
|
||||||
$user = new WP_User( $user_id );
|
$user = new WP_User( $user_id );
|
||||||
|
|
||||||
$user_contactmethods = _wp_get_user_contactmethods();
|
$user_contactmethods = _wp_get_user_contactmethods( $user );
|
||||||
foreach ($user_contactmethods as $method => $name) {
|
foreach ($user_contactmethods as $method => $name) {
|
||||||
if ( empty( $user->{$method} ) )
|
if ( empty( $user->{$method} ) )
|
||||||
$user->{$method} = '';
|
$user->{$method} = '';
|
||||||
|
|
|
@ -322,7 +322,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach (_wp_get_user_contactmethods() as $name => $desc) {
|
foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
||||||
|
|
|
@ -211,20 +211,19 @@ function wp_insert_user($userdata) {
|
||||||
update_user_meta( $user_id, 'admin_color', $admin_color);
|
update_user_meta( $user_id, 'admin_color', $admin_color);
|
||||||
update_user_meta( $user_id, 'use_ssl', $use_ssl);
|
update_user_meta( $user_id, 'use_ssl', $use_ssl);
|
||||||
|
|
||||||
foreach ( _wp_get_user_contactmethods() as $method => $name ) {
|
$user = new WP_User($user_id);
|
||||||
|
|
||||||
|
foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
|
||||||
if ( empty($$method) )
|
if ( empty($$method) )
|
||||||
$$method = '';
|
$$method = '';
|
||||||
|
|
||||||
update_user_meta( $user_id, $method, $$method );
|
update_user_meta( $user_id, $method, $$method );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($role) ) {
|
if ( isset($role) )
|
||||||
$user = new WP_User($user_id);
|
|
||||||
$user->set_role($role);
|
$user->set_role($role);
|
||||||
} elseif ( !$update ) {
|
elseif ( !$update )
|
||||||
$user = new WP_User($user_id);
|
|
||||||
$user->set_role(get_option('default_role'));
|
$user->set_role(get_option('default_role'));
|
||||||
}
|
|
||||||
|
|
||||||
wp_cache_delete($user_id, 'users');
|
wp_cache_delete($user_id, 'users');
|
||||||
wp_cache_delete($user_login, 'userlogins');
|
wp_cache_delete($user_login, 'userlogins');
|
||||||
|
@ -319,15 +318,16 @@ function wp_create_user($username, $password, $email = '') {
|
||||||
* @access private
|
* @access private
|
||||||
* @since
|
* @since
|
||||||
*
|
*
|
||||||
|
* @param object $user User data object (optional)
|
||||||
* @return array $user_contactmethods Array of contact methods and their labels.
|
* @return array $user_contactmethods Array of contact methods and their labels.
|
||||||
*/
|
*/
|
||||||
function _wp_get_user_contactmethods() {
|
function _wp_get_user_contactmethods( $user = null ) {
|
||||||
$user_contactmethods = array(
|
$user_contactmethods = array(
|
||||||
'aim' => __('AIM'),
|
'aim' => __('AIM'),
|
||||||
'yim' => __('Yahoo IM'),
|
'yim' => __('Yahoo IM'),
|
||||||
'jabber' => __('Jabber / Google Talk')
|
'jabber' => __('Jabber / Google Talk')
|
||||||
);
|
);
|
||||||
return apply_filters('user_contactmethods',$user_contactmethods);
|
return apply_filters( 'user_contactmethods', $user_contactmethods, $user );
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue