WordPress.org

Make WordPress Core

Changeset 21375


Ignore:
Timestamp:
07/31/2012 05:39:14 PM (6 years ago)
Author:
nacin
Message:

Don't call get_userdata() every time for the current user in map_meta_cap()'s read_post, edit_post, and delete_post branches. see #21120.

File:
1 edited

Legend:

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

    r21198 r21375  
    961961    case 'delete_post':
    962962    case 'delete_page':
    963         $author_data = get_userdata( $user_id );
    964963        $post = get_post( $args[0] );
    965964
     
    982981        } else {
    983982            // No author set yet, so default to current user for cap checks.
    984             $post_author_data = $author_data;
     983            $post_author_data = get_userdata( $user_id );
    985984        }
    986985
     
    10111010    case 'edit_post':
    10121011    case 'edit_page':
    1013         $author_data = get_userdata( $user_id );
    10141012        $post = get_post( $args[0] );
    10151013
     
    10321030        } else {
    10331031            // No author set yet, so default to current user for cap checks.
    1034             $post_author_data = $author_data;
     1032            $post_author_data = get_userdata( $user_id );
    10351033        }
    10361034
     
    10601058    case 'read_post':
    10611059    case 'read_page':
    1062         $author_data = get_userdata( $user_id );
    10631060        $post = get_post( $args[0] );
    10641061
     
    10871084        } else {
    10881085            // No author set yet, so default to current user for cap checks.
    1089             $post_author_data = $author_data;
     1086            $post_author_data = get_userdata( $user_id );
    10901087        }
    10911088
Note: See TracChangeset for help on using the changeset viewer.