#6060 closed defect (bug) (fixed)
Display and filter by member type on Dashboard > Users
Reported by: | boonebgorges | Owned by: | slaFFik |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Members | Keywords: | good-first-bug has-patch |
Cc: | mercime.one@… |
Description
Now that we support member types #6006, and are providing admin UI for viewing/setting that member type on an individual basis, we should consider the following enhancements to Dashboard > Users:
- a Member Type (sortable?) column
- the ability to filter by Member Type. This could be akin to the current Role links, or perhaps a dropdown (in case there are tons of types)
Attachments (4)
Change History (29)
#3
@
10 years ago
I would suggest these extra columns only show up if 1) there is a member type registered or, 2) hidden by default but with a toggle to show them under the "screen options" panel. Otherwise this becomes clutter for people who aren't using the feature.
#6
@
8 years ago
Users => Manage Signups should have this column as well, as user might select a type while registering.
IMO, we should have 2 dropdowns on Users page:
1) Change member type to...
(same as for roles, with a Change button)
2) All member types
(with a list of all types and a Filter button)
#8
@
8 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 2.7
I decided to not add a Filter by member type
dropdown. Reason - it takes to many space, imagine bbPress activated as well (ordinary scenario):
Change role, Change forum role, Change member type, Filter by member type.
Those dropdowns just don't fit the screen. So I made the type for each user as a link to filter all users.
Column can be made hidden in Screen options.
Dropdown and column are displayed only if any member types are registered.
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.
8 years ago
#13
@
8 years ago
Hi @slaFFik, this is really good. I've tested your new patch this morning and have a few comments:
- The function
users_type_change_to()
relies on a passed parameter$which
to know whether the control is above or below the table. This parameter wasn't passed to the action hook until WP 4.6, so in 4.5 and earlier, the upper dropdown's input never works (it has the samename
as the lower, so it's overwritten in the$_REQUEST
). Is there anything we can do to make this work in 4.5 and earlier? Short of a global variable, I'm not sure how to output the control only once in earlier versions. - The "Change" button uses a duplicated
id
. This is the behavior of the "Change Role" control, too, but I'd still like to avoid it. - I like the way you've handled filtering by type (using the type column output as filter links). This is a nice, unobtrusive touch.
- It would be cool if the Member Type column were sortable, but that could be a future improvement.
Updates I've made in the patch I'll add:
- Use the
$id_name
variable in the label inusers_type_change_to()
- Change the foreach behavior so that all member changes are made before redirecting in
users_type_bulk_change()
.
Thanks for the cool stuff!
This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.
8 years ago
This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.
8 years ago
#16
@
8 years ago
I've gone through this patch again, switching the calls to buddypress()->types
to use the member types fetching functions. I also changed some function names to be more descriptive and filled out the descriptions a bit more. There are two @TODO
s marked that I'd especially like feedback on.
- What's the best way to find all the users of a particular type? The code currently uses
get_objects_in_term()
but maybe doing aBP_User_Query
would be better? - The general WP function
translate_user_role()
is used on the member type name at output, but I'm not sure it will have an effect.
My note from above is still an open question:
The function users_type_change_to() relies on a passed parameter $which to know whether the control is above or below the table. This parameter wasn't passed to the action hook until WP 4.6, so in 4.5 and earlier, the upper dropdown's input never works (it has the same name as the lower, so it's overwritten in the $_REQUEST). Is there anything we can do to make this work in 4.5 and earlier? Short of a global variable, I'm not sure how to output the control only once in earlier versions.
Thanks for your feedback!
#17
@
8 years ago
What's the best way to find all the users of a particular type? The code currently uses get_objects_in_term() but maybe doing a BP_User_Query would be better?
A BP_User_Query
will require more resources, and will also require some work to avoid recursion (since a BP_User_Query
eventually calls 'pre_get_users'). If BP_User_Query
had enough caching that we could avoid hitting the database, I'd say we should switch to it. Since that's not currently the case, get_objects_in_term()
seems like a simpler approach.
The general WP function translate_user_role() is used on the member type name at output, but I'm not sure it will have an effect.
It definitely won't do anything in this context, since translate_user_role()
assumes the default domain, not buddypress
. BP member types work differently from WP roles since they're fully defined in code, so I'd say we can leave this out for now. If it turns out that parts are untranslatable after 2.7, we'll look at what hoops we need to jump through to fix it.
The function users_type_change_to() relies on a passed parameter $which to know whether the control is above or below the table. This parameter wasn't passed to the action hook until WP 4.6, so in 4.5 and earlier, the upper dropdown's input never works (it has the same name as the lower, so it's overwritten in the $_REQUEST). Is there anything we can do to make this work in 4.5 and earlier? Short of a global variable, I'm not sure how to output the control only once in earlier versions.
Meh, I wouldn't go to too much trouble to make this work in earlier versions. Only displaying it once (at the top) seems like it'd be fine in this case. Something like:
public function users_table_output_type_change_select( $which ) { static $displayed; if ( version_compare( bp_get_major_wp_version(), '4.5', '<' ) && ! empty( $displayed ) ) { return; } $displayed = true; ...
I agree, this will be really great.