WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#16045 closed defect (bug) (fixed)

wp_dropdown_users() omits current user if current user no longer has posting privileges

Reported by: markjaquith Owned by:
Milestone: 3.1 Priority: high
Severity: critical Version: 3.1
Component: Administration Keywords:
Focuses: Cc:

Description

in 3.1, #4458 was regressed. wp_dropdown_users() no longer includes the current author if they lack privileges.

I'm patching.

Attachments (2)

16045.diff (1.6 KB) - added by markjaquith 10 years ago.
16045.2.diff (2.5 KB) - added by ryan 10 years ago.
Introduce include_selected flag and add selected user to the end if not returned in the query

Download all attachments as: .zip

Change History (9)

@markjaquith
10 years ago

#1 @aaroncampbell
10 years ago

I know the WHERE 1=1 doesn't affect the query at all, but is it really annoying to anyone else? Is there any disadvantage to doing something like this instead?

$this->query_where = '';
...
if ( '' != $this->query_where ) {
	$this->query_where = 'WHERE ' . $this->query_where;
}

#2 @ryan
10 years ago

I think this needs a group by. Seeing duplicates of the include user.

#3 @nacin
10 years ago

Aaron: If no other WHERE exists, you'll end up with ( ) OR ... when using include. The 1=1 solves that syntax issue.

#4 @aaroncampbell
10 years ago

nacin: You could put the ( '' != $this->query_where ) check in there if needed.

It's not a huge deal...it just annoys me to see a bunch of WHERE 1=1 in my logs everywhere.

#5 @ryan
10 years ago

include is an AND in all other get_*() funcs. Maybe we should leave get_users() as is and fix this with a tweak to wp_dropdown_users().

@ryan
10 years ago

Introduce include_selected flag and add selected user to the end if not returned in the query

#6 @ryan
10 years ago

A more conservative approach for 3.1.

#7 @ryan
10 years ago

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

(In [17198]) Introduce include_selected arg for wp_dropdown_users(). Add current author to dropdown in post_author_meta_box(). fixes #16045

Note: See TracTickets for help on using tickets.