WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#13982 closed defect (bug) (invalid)

Quick edit changes author

Reported by: jfarthing84 Owned by:
Milestone: Priority: normal
Severity: major Version: 3.0
Component: Quick/Bulk Edit Keywords:
Focuses: Cc:

Description

Using the current 3.1-alpha trunk, (so it probably affects 3.0 as well) if I edit a post using quick edit, the post owner becomes the user I am editing the post as, which is definitely undesireable.

Attachments (1)

no-post-author.jpg (214.5 KB) - added by jfarthing84 4 years ago.
Firebug NET view of inline-save. Notice no 'post_author'

Download all attachments as: .zip

Change History (22)

comment:1 ocean904 years ago

  • Priority changed from highest omg bbq to normal
  • Severity changed from blocker to normal

Please take a look at #12802. I think it's a duplicate.

comment:2 jfarthing844 years ago

Nope, it's not related. I created the post with a contributor, author or editor (doesn't matter) and edit it with administrator and it becomes owned by admin.

I'm not sure why you changed my severity and priority, as this is a major problem.

comment:3 jfarthing844 years ago

This s happening because 'post_author' is not passed with the quick edit post (verified via Firebug) and the function _wp_translate_postdata sets 'post_author' to the current global $user_ID if it isn't set. So, it appears simply POSTing 'post_author' with the quick edit post would remedy the issue.

comment:4 ocean904 years ago

I tried to reproduce it, but I can't. post_author is also passed. Any plugins activated?

comment:5 jfarthing844 years ago

No plugins active. I will submit a screenshot of Firebug.

jfarthing844 years ago

Firebug NET view of inline-save. Notice no 'post_author'

comment:6 davemoyer4 years ago

  • Severity changed from normal to major

Having the same issue here running the current 3.0 version with network functionality enabled. Even when simply changing something like a date or tag in the Quick Editor, the author is changed from the original to the author doing these simple edits. This is a serious issue and definitely isn't related to plugins. Hoping we can get it fixed.

comment:7 nacin3 years ago

  • Keywords reporter-feedback added; needs-patch removed
  • Milestone changed from Awaiting Review to Future Release

Need a way to reproduce this. Role of the original author, perhaps?

comment:9 nacin3 years ago

Can't reproduce this.

If I'm an author or below, I don't get a post author box. No post author is passed, but that's also because I can only edit my posts.

If I'm an editor or above, I get a post author box. The post author is always passed.

comment:10 jfarthing843 years ago

There is no post author box in the quick/inline edit...

comment:13 nacin3 years ago

These conditions are required for a dropdown to be printed:

( post_type_supports( $screen->post_type, 'author' ) ) 
&&
( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )

comment:14 jfarthing843 years ago

What version is your screenshot from? Mine was from 3.0.1. I just tested the current trunk, and it's there...

comment:15 nacin3 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Future Release to 3.1

That was from 3.1-alpha.

Testing now on the 3.0 branch. I set a post to a second user. Box only showed up after I added a second user on 3.0.x, but the second user also had to be at least a contributor. If the second user is a post author but doesn't have permissions to be assigned a post author (i.e. subscriber), now I can reproduce. That seems like an edge case but a valid bug.

In 3.1, the box shows up not only when the second user is a subscriber, but even when there is only one user.

How it should work:

  • The box should only show if there is more than one contributor on the blog.
  • Only contributors and above should appear in the box.
  • If a subscriber is a post author, then the box should so, and the subscriber should be listed and selected.

comment:16 jfarthing843 years ago

In 3.0.1, I have an administrator and an author. I publish a post as the author. Then, as the administrator, using the quick edit, there is no post author box and clicking Update changes the author to the admin.

comment:17 nacin3 years ago

That I can't reproduce. The administrator sees an author box as long as there is at least one other user a contributor or higher.

Here's the code in 3.0.x from wp-admin/includes/template. Going to need some help if we're going to fix this --- where is it failing for you?

	if ( post_type_supports( $screen->post_type, 'author' ) ) :
		$authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
		$authors_dropdown = '';
		if ( $authors && count( $authors ) > 1 ) :
			$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
			if ( $bulk )
				$users_opt['show_option_none'] = __('— No Change —');
			$authors_dropdown  = '<label>';
			$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
			$authors_dropdown .= wp_dropdown_users( $users_opt );
			$authors_dropdown .= '</label>';

		endif; // authors

comment:18 jfarthing843 years ago

Well, I found my problem. In this case, it's NOT a bug.

The problem was simply that '{wp}_user_level' was not set for my administrator, for some reason, causing get_editable_user_ids() to only return the author's ID, therefore hiding the author box.

comment:19 jane3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Closing ticket since reporter stated, "In this case, it's NOT a bug."

comment:20 nacin3 years ago

I'll create a new ticket.

comment:21 ocean903 years ago

  • Milestone 3.1 deleted
Note: See TracTickets for help on using tickets.