WordPress.org

Make WordPress Core

Changeset 41668


Ignore:
Timestamp:
10/02/2017 03:37:29 AM (22 months ago)
Author:
jeremyfelt
Message:

Multisite: Deprecate is_user_option_local().

is_user_option_local() was added during MU development and used for a handful of changesets before the code using it was removed again. It has not been used by MU or core since nor is it widely used elsewhere.

Fixes #41697.
Props bnap00, jeremyfelt.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-deprecated.php

    r41664 r41668  
    520520    return $results;
    521521}
     522
     523/**
     524 * Check whether a usermeta key has to do with the current blog.
     525 *
     526 * @since MU (3.0.0)
     527 * @deprecated 4.9.0
     528 *
     529 * @global wpdb $wpdb WordPress database abstraction object.
     530 *
     531 * @param string $key
     532 * @param int    $user_id Optional. Defaults to current user.
     533 * @param int    $blog_id Optional. Defaults to current blog.
     534 * @return bool
     535 */
     536function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
     537    global $wpdb;
     538
     539    _deprecated_function( __FUNCTION__, '4.9.0' );
     540
     541    $current_user = wp_get_current_user();
     542    if ( $blog_id == 0 ) {
     543        $blog_id = get_current_blog_id();
     544    }
     545    $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
     546
     547    return isset( $current_user->$local_key );
     548}
  • trunk/src/wp-includes/ms-functions.php

    r41661 r41668  
    22022202
    22032203/**
    2204  * Check whether a usermeta key has to do with the current blog.
    2205  *
    2206  * @since MU (3.0.0)
    2207  *
    2208  * @global wpdb $wpdb WordPress database abstraction object.
    2209  *
    2210  * @param string $key
    2211  * @param int    $user_id Optional. Defaults to current user.
    2212  * @param int    $blog_id Optional. Defaults to current blog.
    2213  * @return bool
    2214  */
    2215 function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
    2216     global $wpdb;
    2217 
    2218     $current_user = wp_get_current_user();
    2219     if ( $blog_id == 0 ) {
    2220         $blog_id = get_current_blog_id();
    2221     }
    2222     $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
    2223 
    2224     return isset( $current_user->$local_key );
    2225 }
    2226 
    2227 /**
    22282204 * Check whether users can self-register, based on Network settings.
    22292205 *
Note: See TracChangeset for help on using the changeset viewer.