Make WordPress Core

Changeset 25606


Ignore:
Timestamp:
09/24/2013 06:13:18 PM (11 years ago)
Author:
nacin
Message:

Introduce wp_get_user_contact_methods() as a public version of _wp_get_user_contactmethods.

props johnnyb.
fixes #24273.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r25204 r25606  
    8686        $user->description = trim( $_POST['description'] );
    8787
    88     foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
     88    foreach ( wp_get_user_contact_methods( $user ) as $method => $name ) {
    8989        if ( isset( $_POST[$method] ))
    9090            $user->$method = sanitize_text_field( $_POST[$method] );
  • trunk/src/wp-admin/user-edit.php

    r25330 r25606  
    351351
    352352<?php
    353     foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
     353    foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
    354354?>
    355355<tr>
  • trunk/src/wp-includes/user.php

    r25392 r25606  
    15401540function _get_additional_user_keys( $user ) {
    15411541    $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );
    1542     return array_merge( $keys, array_keys( _wp_get_user_contactmethods( $user ) ) );
    1543 }
    1544 
    1545 /**
    1546  * Set up the contact methods.
     1542    return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
     1543}
     1544
     1545/**
     1546 * Set up the user contact methods.
    15471547 *
    15481548 * Default contact methods were removed in 3.6. A filter dictates contact methods.
    15491549 *
    1550  * @since 2.9.0
    1551  * @access private
    1552  *
    1553  * @param object $user User data object (optional).
    1554  * @return array $user_contactmethods Array of contact methods and their labels.
    1555  */
    1556 function _wp_get_user_contactmethods( $user = null ) {
    1557     $user_contactmethods = array();
     1550 * @since 3.7.0
     1551 *
     1552 * @param WP_User $user Optional. WP_User object.
     1553 * @return array Array of contact methods and their labels.
     1554 */
     1555function wp_get_user_contact_methods( $user = null ) {
     1556    $methods = array();
    15581557    if ( get_site_option( 'initial_db_version' ) < 23588 ) {
    1559         $user_contactmethods = array(
     1558        $methods = array(
    15601559            'aim'    => __( 'AIM' ),
    15611560            'yim'    => __( 'Yahoo IM' ),
     
    15631562        );
    15641563    }
    1565     return apply_filters( 'user_contactmethods', $user_contactmethods, $user );
     1564
     1565    /**
     1566     * Filter the user contact methods.
     1567     *
     1568     * @since 2.9.0
     1569     *
     1570     * @param array   $methods Array of contact methods and their labels.
     1571     * @param WP_User $user    Optional. WP_User object.
     1572     */
     1573    return apply_filters( 'user_contactmethods', $methods, $user );
     1574}
     1575
     1576/**
     1577 * The old private function for setting up user contact methods.
     1578 *
     1579 * @since 2.9.0
     1580 * @access private
     1581 */
     1582function _wp_get_user_contactmethods( $user = null ) {
     1583    return wp_get_user_contact_methods( $user );
    15661584}
    15671585
Note: See TracChangeset for help on using the changeset viewer.