#15871 closed defect (bug) (fixed)
Quick edit and metabox author dropdowns show all users
Reported by: | duck_ | Owned by: | scribu |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | blocker | Version: | 3.1 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
The author dropdowns displayed in quick edit, bulk edit and the author metabox on the post edit screen now show all users rather than just those who are user_level != 0.
The dropdown is now also shown even when there is only one author to choose from.
Both are a regression from 3.0.3.
See, 15786
Attachments (9)
Change History (44)
#2
follow-up:
↓ 4
@
14 years ago
Can't afford to, based on custom roles. It would need to be any minus roles that have nothing more than the 'read' cap.
#3
@
14 years ago
Relevant code in 3.0:
http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/includes/template.php#L930
Equivalent code in 3.1:
http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/class-wp-posts-list-table.php#L763
#4
in reply to:
↑ 2
@
14 years ago
Replying to nacin:
Can't afford to, based on custom roles. It would need to be any minus roles that have nothing more than the 'read' cap.
Yeah, was thinking the same. But then user_level=0 would have even less meaning.
#6
@
14 years ago
- Severity changed from normal to blocker
Still technically a blocker. A) regression in itself, B) it can cause memory exhaustion trivially.
#7
@
14 years ago
Went with excluding subscribers. Even though it's not ideal, it's still better than user_level=0 or leaving as is.
Still need to do the same for the metabox.
#8
@
14 years ago
- Keywords has-patch added
Made a little helper function, to ensure the list of users stays the same between the metabox and the inline edit dropdowns.
#9
@
14 years ago
I would rather go with user_level != 0 unless we can properly support custom roles. Too late for changes.
#10
@
14 years ago
I really don't see advantage to that. User levels are deprecated and the patch is the same either way.
#12
@
14 years ago
Not if I have a role on my site that has 30,000 users in a custom role. We use 'subscriber' as former authors, and the custom role is called 'Member.' This would regress performance when the custom role was specifically designed for performance.
Now is not the time for API changes.
#14
@
14 years ago
Because the custom role has read = true and user_level = 0.
I have no problem eventually dropping the user_level check. But we need to move to caps, not role names.
#16
@
14 years ago
We should select in the same way we did in 3.0. Unfortunately it wasn't consistent between single and multisite. I think multisite looked for capabilities in the usermeta and thus probably ended up including all users.
#17
follow-ups:
↓ 18
↓ 19
@
14 years ago
Fetch all roles that do not have edit_posts (or the CPT equivalent)? Select users that do not have those roles? Without a cap plugin this would always be just the subscriber role.
#18
in reply to:
↑ 17
@
14 years ago
Replying to ryan:
Fetch all roles that do not have edit_posts (or the CPT equivalent)? Select users that do not have those roles? Without a cap plugin this would always be just the subscriber role.
Exactly. levels.15871.diff mimics 3.0 behaviour. I had to do some shufling in get_meta_sql() to accept '0' as a meta value.
#19
in reply to:
↑ 17
@
14 years ago
Replying to ryan:
Fetch all roles that do not have edit_posts (or the CPT equivalent)? Select users that do not have those roles? Without a cap plugin this would always be just the subscriber role.
Or, just select those users with roles that do have the edit_posts cap or equivalent.
#20
follow-up:
↓ 21
@
14 years ago
To select on roles that do you would have to OR a lot of LIKEs versus one NOT LIKE.
#21
in reply to:
↑ 20
@
14 years ago
Replying to ryan:
To select on roles that do you would have to OR a lot of LIKEs versus one NOT LIKE.
Assuming one NOT LIKE is faster. Not necessarily the case.
#22
@
14 years ago
We'll have to go with NOT LIKE for now, since 'meta_query' doesn't support OR, like 'tax_query' does.
See caps.15871.diff
#23
@
14 years ago
What do you think about adding 'who' => 'authors' to wp_dropdown_users() and perhaps get_users() and avoid the helper function and the extra passing around of users?
#24
@
14 years ago
Currently, _get_potential_authors() uses the $post_type global to find the correct cap. I don't see how 'who' => 'authors' could be post type aware.
Maybe have a lower-level 'capability' arg instead.
#25
@
14 years ago
I wasn't aware of the goal to be post-type aware at all. Anything is better than what we have now. How much can wait for 3.2? (Especially if we finally pull the trigger on #10201.)
#27
@
14 years ago
caps.15871.2.diff moves the capability => roles => meta_query logic to WP_User_Query.
#28
@
14 years ago
levels.15871.2.diff makes a direct query to get the users, to avoid the modifications necessary in get_meta_sql() which could introduce other bugs.
Also, it doesn't check for !is_multisite() anymore since it's not necessary.
#29
@
14 years ago
Adds 'who' support. Add 'show_option_gt_one' for only showing the dropdown when there is more than one user present. Added lame temp hack to get '0' meta_value queries without having to redo get_meta_sql().
#31
@
14 years ago
Per IRC discussion, name the new option something like hide_if_only_one_author and make it a bool.
We have to get rid of user levels at some point. We could probably replace that with role != subscriber.