Make WordPress Core


Ignore:
Timestamp:
12/07/2012 09:53:27 AM (12 years ago)
Author:
ryan
Message:

Make current_user_can_for_blog() safe to run single site.

Props nacin, MarkJaquith
fixes #22803

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r22908 r23117  
    13001300 */
    13011301function current_user_can_for_blog( $blog_id, $capability ) {
    1302     switch_to_blog( $blog_id );
     1302    if ( is_multisite() )
     1303        switch_to_blog( $blog_id );
    13031304
    13041305    $current_user = wp_get_current_user();
     
    13121313    $can = call_user_func_array( array( $current_user, 'has_cap' ), $args );
    13131314
    1314     restore_current_blog();
     1315    if ( is_multisite() )
     1316        restore_current_blog();
    13151317
    13161318    return $can;
Note: See TracChangeset for help on using the changeset viewer.