Opened 18 years ago
Closed 18 years ago
#2793 closed enhancement (fixed)
User Management: Paging, Search, Bug Fixes
Reported by: | markjaquith | Owned by: | markjaquith |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 2.1 |
Component: | Administration | Keywords: | needs-testing has-patch so-many-patches |
Focuses: | Cc: |
Description
Attached patch adds the following:
User Paging
Users page, 50 at a time. If there are more than 50 users, a small notice is shown explaining that all the users can't be shown on one page, and that people will have to use the previous/next navigation or the search, in order to find the user they want.
Wait a second, search?!
User Search
Yes, search. Now, you can search for users based on user_login, user_nicename, user_email, display_name or user_url. Results are paged when over 50, naturally.
thead bug fixed
The first <thead> with the ID/Username/email/etc headers, gets pushed to the TOP of the table in Firefox. So, it looks funky for the first one, but the following ones look fine.
I just switched to using a classed <tr class="thead"> and added .thead
to the thead
CSS declaration.
"Cannot delete user" error bug fixed
$error = new WP_Error('etc', 'etc');
changed to the correct:
$errors = new WP_Error('etc', 'etc');
Everything is (I think) properly i18n'd. I took proper precautions with regards to casting to int and wp_specialchars()
protection of the search term.
Even better, I have this patched for /branches/2.0/ as well as /trunk/
Attachments (15)
Change History (36)
@
18 years ago
Helper script for /trunk/ --- creates something like 900 users. Place in /wp-admin/ and access via browser.
#1
@
18 years ago
- Keywords needs-testing added
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
create-lots-of-users.php
is a helper script that I wrote for /trunk/
(won't work on /branches/2.0/
) in order to facilitate mass import and mass deletion of users. Put it in your /wp-admin/
folder and then access it via browser. It'll create a crapload of users (somewhere around 900, I forget the exact number) by doing every combination of an array of first names and an array of last names.
It'll also give you the SQL queries you need to get rid of the users when you're done.
Using this, you can search for something like "jones" to get a result under 50, and search for "@comcast.net" to get a result of over 50.
#2
@
18 years ago
- Keywords has-patch added
Great work, Mark, everything worked flawlessly. While testing this, I came across a few old annoyances I thought I'd fix while I was in this area of WP. As such, here's my patch that contains all your fixes, plus a few extras:
- If you have the edit_users cap, clicking 'Users' on the menu takes you to the user management page, instead of the 'Your profile' page. The order of those two pages in the Users submenu has been flipped to respect this change.
- A lot of new users don't know you can click on the number of posts to see exactly those posts. I only found out months after using WP! Also, it was a tiny target to try and position your cursor over. So, I changed it into an action like the 'Edit' option: 'View n post(s)'. Perhaps we need a better wording here, I couldn't think of one that was sufficiently concise and clear.
- I changed your patch to include the 'Results x-y of z' on every page, because I like it that way :)
I think that's all. See if you like it.
Oh, and bg|has-patch! Some of use actually use the 'Needs patch' report :)
#3
@
18 years ago
Great work, Mark, everything worked flawlessly. While testing this, I came across a few old annoyances I thought I'd fix while I was in this area of WP. As such, here's my patch that contains all your fixes, plus a few extras:
- If you have the edit_users cap, clicking 'Users' on the menu takes you to the user management page, instead of the 'Your profile' page. The order of those two pages in the Users submenu has been flipped to respect this change.
- A lot of new users don't know you can click on the number of posts to see exactly those posts. I only found out months after using WP! Also, it was a tiny target to try and position your cursor over. So, I changed it into an action like the 'Edit' option: 'View n post(s)'. Perhaps we need a better wording here, I couldn't think of one that was sufficiently concise and clear.
- I changed your patch to include the 'Results x-y of z' on every page, because I like it that way :)
I think that's all. See if you like it.
Oh, and bg|has-patch! Some of use actually use the 'Needs patch' report :)
#5
@
18 years ago
Something else which was in my patch but I forgot to mention:
- When you search for something, there was no way to get back to showing all the users. My extras include some 'Reset search' text which just pop you back to users.php.
@
18 years ago
i18n fixes, moved the notification box above the search, reworded the link back to "all users"
#6
@
18 years ago
2703.3
has i18n fixes, moves the notification box up above the search, and rewords the link back to "all users"
#7
@
18 years ago
2703.4
takes out a random change left in there by David (c'mon man... svn revert
!), fixes menu highlighting, and fixes a remove_query_arg()
bug I ran into (whereby its second param was required)
Looking pretty good at this point.
#8
@
18 years ago
Looks great from where I'm sitting. Anyone else want to give this a whirl, then place a bc|commit on it?
#9
@
18 years ago
2793.5
does stripslashes()
on search results before printing to search box, to avoid ugliness.
Ringmaster brought something up... when editing a user, like changing their role, you're brought back to the front page. I'm heading out the door, but I can fix this when I return.
#10
@
18 years ago
2793.6
- Returns you to the page you were viewing, when you:
- Create a new user
- Change users' roles
- Delete users
- I cleaned up a lot of code... spaces to tabs, proper whitespace, etc.
- Fixes for
add_query_arg()
andremove_query_arg()
- No longer freaks out if you pass it a full URL with
http://
orhttps://
- You can now pass an array of keys to
remove_query_arg()
and it will remove them all (HANDY!) - Slashes are properly stripped on setups with magicquotes (in
add_query_arg()
,parse_str()
is used, which slashes things if magicquotes is on)
- No longer freaks out if you pass it a full URL with
- When you delete users, the number of users you deleted is displayed in the resulting message.
- Proper i18n, including use of
__ngettext()
, where applicable
#11
@
18 years ago
- Keywords so-many-patches added
2793.8
- Submenu for
edit-user.php
fixed - When you edit a user, you are given a link back to the
users.php
page you were on (i.e., search term and page number) - When you create a new user (JavaScript off), you are redirected to a
users.php
view of that user - When you attempt to create a new user (Javascript off), but there is an error, the HTML form is repopulated with your attempted data, and the error box appears below the form, just like how it works with the AJAX user creation. Now the user experience is identical with or without JavaScript
#13
@
18 years ago
- Milestone set to 2.1
Suggestions: Move the user search into the main wrap to maintain consistency with other management pages. Move the query logic into a local function so that template and backend code have some separation.
#14
@
18 years ago
reorganize_users.php.diff
does the wrap reorganization, and shuffles some other stuff around to look nicer.
Go ahead and apply that and I'll move the query logic into a local function (or maybe a class, there are quite a few variables to keep track of) next.
#16
@
18 years ago
WP_User_Search_class.diff
moves the search and paging to a class, defined near the top of the file, so that there is better code/template separation.
#17
@
18 years ago
Nice. How about calling it WP_User_Query() and have the constructor support passing args in via associative array or query string the way we do in other places? Should we put this in admin-db.php? Are there other places we can use it right now?
#18
@
18 years ago
Right now, it's pretty much a one-job class. With some more work, we could make it into a generic admin search/paging class, and use it for posts and comments as well. WP_Admin_Query
#20
@
18 years ago
I love this user paging. It's just what I needed for a site I'm
working on that has about 40,000 subscribers.
What I also needed I've attached as a patch: an alphabetizing system.
Patch for /trunk/