Changeset 18504 for trunk/wp-includes/capabilities.php
- Timestamp:
- 08/04/2011 03:09:27 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/capabilities.php
r18476 r18504 361 361 * User data container. 362 362 * 363 * This will be set as properties of the object.364 *365 363 * @since 2.0.0 366 364 * @access private … … 377 375 */ 378 376 var $ID = 0; 379 380 /**381 * The deprecated user's ID.382 *383 * @since 2.0.0384 * @access public385 * @deprecated Use WP_User::$ID386 * @see WP_User::$ID387 * @var int388 */389 var $id = 0;390 377 391 378 /** … … 472 459 */ 473 460 function __construct( $id, $name = '', $blog_id = '' ) { 474 475 461 if ( empty( $id ) && empty( $name ) ) 476 462 return; … … 489 475 return; 490 476 491 foreach ( get_object_vars( $this->data ) as $key => $value ) { 492 $this->{$key} = $value; 493 } 494 495 $this->id = $this->ID; 477 $this->ID = $this->data->ID; 496 478 $this->for_blog( $blog_id ); 479 } 480 481 /** 482 * Magic method for checking the existance of a certain custom field 483 * 484 * @since 3.3.0 485 */ 486 function __isset( $key ) { 487 return isset( $this->data->$key ); 488 } 489 490 /** 491 * Magic method for accessing custom fields 492 * 493 * @since 3.3.0 494 */ 495 function __get( $key ) { 496 if ( 'id' == $key ) { 497 _deprecated_argument( 'WP_User->id', '2.1', __( 'Use <code>WP_User->ID</code> instead.' ) ); 498 return $this->ID; 499 } 500 501 return $this->data->$key; 502 } 503 504 /** 505 * Magic method for setting custom fields 506 * 507 * @since 3.3.0 508 */ 509 function __set( $key, $value ) { 510 $this->data->$key = $value; 497 511 } 498 512 … … 512 526 function _init_caps( $cap_key = '' ) { 513 527 global $wpdb; 528 514 529 if ( empty($cap_key) ) 515 530 $this->cap_key = $wpdb->prefix . 'capabilities'; 516 531 else 517 532 $this->cap_key = $cap_key; 518 $this->caps = &$this->{$this->cap_key}; 533 534 $this->caps = &$this->data->{$this->cap_key}; 519 535 if ( ! is_array( $this->caps ) ) 520 536 $this->caps = array(); 537 521 538 $this->get_role_caps(); 522 539 } … … 957 974 $post = get_post( $args[0] ); 958 975 $post_type_object = get_post_type_object( $post->post_type ); 959 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 960 961 $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false; 962 976 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 977 978 $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false; 979 963 980 if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}" ) ) { 964 981 $allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps ); … … 1081 1098 1082 1099 // Create new object to avoid stomping the global current_user. 1083 $user = new WP_User( $current_user-> id) ;1100 $user = new WP_User( $current_user->ID) ; 1084 1101 1085 1102 // Set the blog id. @todo add blog id arg to WP_User constructor? … … 1226 1243 $user = wp_get_current_user(); 1227 1244 1228 if ( empty( $user-> id) )1245 if ( empty( $user->ID ) ) 1229 1246 return false; 1230 1247
Note: See TracChangeset
for help on using the changeset viewer.