Changeset 25669
- Timestamp:
- 10/02/2013 09:09:52 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r25558 r25669 1373 1373 1374 1374 // rename 1375 $data['user_ID'] = $GLOBALS['user_ID'];1375 $data['user_ID'] = get_current_user_id(); 1376 1376 1377 1377 if ( isset($data['post_parent']) ) -
trunk/src/wp-admin/includes/post.php
r25505 r25669 53 53 $post_data['to_ping'] = $post_data['trackback_url']; 54 54 55 $post_data['user_ID'] = $GLOBALS['user_ID'];55 $post_data['user_ID'] = get_current_user_id(); 56 56 57 57 if (!empty ( $post_data['post_author_override'] ) ) { … … 267 267 add_meta( $post_ID ); 268 268 269 update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID);269 update_post_meta( $post_ID, '_edit_last', get_current_user_id() ); 270 270 271 271 wp_update_post( $post_data ); … … 539 539 */ 540 540 function wp_write_post() { 541 global $user_ID;542 543 541 if ( isset($_POST['post_type']) ) 544 542 $ptype = get_post_type_object($_POST['post_type']); -
trunk/src/wp-includes/post.php
r25661 r25669 2656 2656 * 2657 2657 * @global wpdb $wpdb WordPress database abstraction object. 2658 * @global int $user_ID2659 2658 * 2660 2659 * @since 1.0.0 … … 2667 2666 * @type string 'post_status' The post status. Default 'draft'. 2668 2667 * @type string 'post_type' The post type. Default 'post'. 2669 * @type int 'post_author' The ID of the user who added the post. Default $user_ID,the current user ID.2668 * @type int 'post_author' The ID of the user who added the post. Default the current user ID. 2670 2669 * @type bool 'ping_status' Whether the post can accept pings. Default value of 'default_ping_status' option. 2671 2670 * @type int 'post_parent' Set this for the post it belongs to, if any. Default 0. … … 2683 2682 */ 2684 2683 function wp_insert_post( $postarr, $wp_error = false ) { 2685 global $wpdb, $user_ID; 2686 2687 $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 2684 global $wpdb; 2685 2686 $user_id = get_current_user_id(); 2687 2688 $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_id, 2688 2689 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 2689 2690 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', … … 2750 2751 2751 2752 if ( empty($post_author) ) 2752 $post_author = $user_ ID;2753 $post_author = $user_id; 2753 2754 2754 2755 // Don't allow contributors to set the post slug for pending review posts … … 3944 3945 * @since 2.0.0 3945 3946 * @uses $wpdb 3946 * @uses $user_ID3947 3947 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. 3948 3948 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. … … 3954 3954 */ 3955 3955 function wp_insert_attachment($object, $file = false, $parent = 0) { 3956 global $wpdb, $user_ID; 3957 3958 $defaults = array('post_status' => 'inherit', 'post_type' => 'post', 'post_author' => $user_ID, 3956 global $wpdb; 3957 3958 $user_id = get_current_user_id(); 3959 3960 $defaults = array('post_status' => 'inherit', 'post_type' => 'post', 'post_author' => $user_id, 3959 3961 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 'post_title' => '', 3960 3962 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'post_content' => '', … … 3973 3975 3974 3976 if ( empty($post_author) ) 3975 $post_author = $user_ ID;3977 $post_author = $user_id; 3976 3978 3977 3979 $post_type = 'attachment'; … … 4497 4499 * @since 2.2.0 4498 4500 * 4499 * @uses $user_ID4500 *4501 4501 * @param string $post_type currently only supports 'post' or 'page'. 4502 4502 * @return string SQL code that can be added to a where clause. … … 4519 4519 */ 4520 4520 function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) { 4521 global $ user_ID, $wpdb;4521 global $wpdb; 4522 4522 4523 4523 // Private posts … … 4549 4549 } elseif ( is_user_logged_in() ) { 4550 4550 // Users can view their own private posts. 4551 $id = (int) $user_ID;4551 $id = get_current_user_id(); 4552 4552 if ( null === $post_author || ! $full ) { 4553 4553 $sql .= " OR post_status = 'private' AND post_author = $id"; -
trunk/src/wp-includes/query.php
r25668 r25669 2141 2141 */ 2142 2142 function get_posts() { 2143 global $wpdb , $user_ID;2143 global $wpdb; 2144 2144 2145 2145 $this->parse_query(); … … 2714 2714 } 2715 2715 2716 $user_id = get_current_user_id(); 2717 2716 2718 if ( !empty($e_status) ) { 2717 2719 $statuswheres[] = "(" . join( ' AND ', $e_status ) . ")"; … … 2719 2721 if ( !empty($r_status) ) { 2720 2722 if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) ) 2721 $statuswheres[] = "($wpdb->posts.post_author = $user_ ID" . "AND (" . join( ' OR ', $r_status ) . "))";2723 $statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))"; 2722 2724 else 2723 2725 $statuswheres[] = "(" . join( ' OR ', $r_status ) . ")"; … … 2725 2727 if ( !empty($p_status) ) { 2726 2728 if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) ) 2727 $statuswheres[] = "($wpdb->posts.post_author = $user_ ID" . "AND (" . join( ' OR ', $p_status ) . "))";2729 $statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))"; 2728 2730 else 2729 2731 $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")"; … … 2758 2760 $private_states = get_post_stati( array('private' => true) ); 2759 2761 foreach ( (array) $private_states as $state ) 2760 $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_ IDAND $wpdb->posts.post_status = '$state'";2762 $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'"; 2761 2763 } 2762 2764
Note: See TracChangeset
for help on using the changeset viewer.