| @@ 130-136 (lines=7) @@ | ||
| 127 | $input['date'] = date( 'Y-m-d H:i:s', $time_with_offset ); |
|
| 128 | } |
|
| 129 | ||
| 130 | if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) { |
|
| 131 | if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { |
|
| 132 | return new WP_Error( 'unauthorized', "User is not allowed to publish others' posts.", 403 ); |
|
| 133 | } elseif ( ! user_can( $author_id, $post_type->cap->edit_posts ) ) { |
|
| 134 | return new WP_Error( 'unauthorized', 'Assigned author cannot publish post.', 403 ); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | ||
| 138 | if ( !is_post_type_hierarchical( $post_type->name ) && 'revision' !== $post_type->name ) { |
|
| 139 | unset( $input['parent'] ); |
|
| @@ 135-141 (lines=7) @@ | ||
| 132 | $input['date'] = date( 'Y-m-d H:i:s', $time_with_offset ); |
|
| 133 | } |
|
| 134 | ||
| 135 | if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) { |
|
| 136 | if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { |
|
| 137 | return new WP_Error( 'unauthorized', "User is not allowed to publish others' posts.", 403 ); |
|
| 138 | } elseif ( ! user_can( $author_id, $post_type->cap->edit_posts ) ) { |
|
| 139 | return new WP_Error( 'unauthorized', 'Assigned author cannot publish post.', 403 ); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| 143 | if ( !is_post_type_hierarchical( $post_type->name ) && 'revision' !== $post_type->name ) { |
|
| 144 | unset( $input['parent'] ); |
|
| @@ 110-116 (lines=7) @@ | ||
| 107 | $input['date'] = date( 'Y-m-d H:i:s', $time_with_offset ); |
|
| 108 | } |
|
| 109 | ||
| 110 | if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) { |
|
| 111 | if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { |
|
| 112 | return new WP_Error( 'unauthorized', "User is not allowed to publish others' posts.", 403 ); |
|
| 113 | } elseif ( ! user_can( $author_id, $post_type->cap->edit_posts ) ) { |
|
| 114 | return new WP_Error( 'unauthorized', 'Assigned author cannot publish post.', 403 ); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | if ( !is_post_type_hierarchical( $post_type->name ) && 'revision' !== $post_type->name ) { |
|
| 119 | unset( $input['parent'] ); |
|