Introduce wp_get_user_contact_methods() as a public version of _wp_get_user_contactmethods.

props johnnyb.
fixes #24273.

Built from https://develop.svn.wordpress.org/trunk@25606


git-svn-id: http://core.svn.wordpress.org/trunk@25523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-09-24 18:14:09 +00:00
parent dba857a39a
commit 00c545606e
3 changed files with 30 additions and 12 deletions

View File

@ -85,7 +85,7 @@ function edit_user( $user_id = 0 ) {
if ( isset( $_POST['description'] ) )
$user->description = trim( $_POST['description'] );
foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
foreach ( wp_get_user_contact_methods( $user ) as $method => $name ) {
if ( isset( $_POST[$method] ))
$user->$method = sanitize_text_field( $_POST[$method] );
}

View File

@ -350,7 +350,7 @@ if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c
</tr>
<?php
foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
?>
<tr>
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>

View File

@ -1539,30 +1539,48 @@ function wp_create_user($username, $password, $email = '') {
*/
function _get_additional_user_keys( $user ) {
$keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );
return array_merge( $keys, array_keys( _wp_get_user_contactmethods( $user ) ) );
return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
}
/**
* Set up the contact methods.
* Set up the user contact methods.
*
* Default contact methods were removed in 3.6. A filter dictates contact methods.
*
* @since 2.9.0
* @access private
* @since 3.7.0
*
* @param object $user User data object (optional).
* @return array $user_contactmethods Array of contact methods and their labels.
* @param WP_User $user Optional. WP_User object.
* @return array Array of contact methods and their labels.
*/
function _wp_get_user_contactmethods( $user = null ) {
$user_contactmethods = array();
function wp_get_user_contact_methods( $user = null ) {
$methods = array();
if ( get_site_option( 'initial_db_version' ) < 23588 ) {
$user_contactmethods = array(
$methods = array(
'aim' => __( 'AIM' ),
'yim' => __( 'Yahoo IM' ),
'jabber' => __( 'Jabber / Google Talk' )
);
}
return apply_filters( 'user_contactmethods', $user_contactmethods, $user );
/**
* Filter the user contact methods.
*
* @since 2.9.0
*
* @param array $methods Array of contact methods and their labels.
* @param WP_User $user Optional. WP_User object.
*/
return apply_filters( 'user_contactmethods', $methods, $user );
}
/**
* The old private function for setting up user contact methods.
*
* @since 2.9.0
* @access private
*/
function _wp_get_user_contactmethods( $user = null ) {
return wp_get_user_contact_methods( $user );
}
/**