Changeset 25669 for trunk/src/wp-includes/post.php
- Timestamp:
- 10/02/2013 09:09:52 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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";
Note: See TracChangeset
for help on using the changeset viewer.