#3430 closed enhancement (fixed)
Groups Members - add Order by: Group Activity
Reported by: | slaFFik | Owned by: | slaFFik |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Groups | Keywords: | has-patch |
Cc: |
Description
I propose to add new filter in "Order by" select box on group members page called Group Activity.
Selecting this will retrieve group members in activity backward chronological order.
I think this feature will be useful to see all members that are active not throughout the site, but in this particular group only.
Don't think it should be a plugin.
Attachments (3)
Change History (14)
#2
@
13 years ago
Yes, Paul, you got my idea :)
So it will be possible than award such "active in the group" members and easier for admins to track group "health".
#3
@
11 years ago
- Keywords needs-patch added; dev-feedback removed
The logic for the group ordering would look something like this:
SELECT DISTINCT user_id FROM wp_bp_activity WHERE component = 'groups' AND item_id = {$group_id} ORDER BY date_recorded DESC
I don't see that there's a reason to cache this in the same way we cache 'last_activity', especially since it'd mean a separate value for every group in which a user has been active.
This does seem like a reasonable request and not totally inappropriate for core. If anyone wants to have a shot at a patch, have a look at BP_User_Query
and the logic suggested above as a starting place.
#4
@
11 years ago
- Keywords has-patch added; needs-patch removed
After some tests, i'm suggesting 3430.patch.
#5
follow-up:
↓ 6
@
11 years ago
- Keywords needs-unit-tests added
- Milestone changed from Future Release to 2.1
Thanks, imath. Logic looks good. Let's get this bit broken out into a separate method so it can be tested (and possibly cached), and then let's get a unit test or two for it.
#6
in reply to:
↑ 5
@
11 years ago
Replying to boonebgorges:
Thanks, imath ... (and possibly cached), and then let's get a unit test or two for it.
I'm not sure of the best way to cache this. But i've tried to improve the patch (3430.02.patch), and to write a unit test (my first.. needs to be checked!!)
#7
@
11 years ago
- Keywords needs-refresh added; has-patch needs-unit-tests removed
Hi imath -
Don't worry about the caching for now. I just meant that having it broken out into a separate methed will make it easier to cache in the future.
Unit test is on the right track, but it looks to me like the 'group_activity' sort type will result in the same order as 'last_updated', so we can't necessarily depend on the results of the test. I suggest the following: create 3 users with consecutive 'date_modified' dates. Then create three pieces of activity and order it so that the results of the 'group_activity' ordering should be array( $u2, $u1, $u3 )
(or something that definitely could not arise by accident). It might make sense not to use the 'joined_group' activity item for this reason - you could really just use 'foo', since it shouldn't matter from the query's point of view :)
#8
@
11 years ago
- Keywords has-patch added; needs-refresh removed
Hi boonebgorges,
Thanks for your feedback and advices, i've refreshed the patch (3430.03.patch)
You mean not when the member was "last active" (like current filter), but a "group last active" for when the member was last active in the group? We don't store that meta data at the moment, but it's an interesting idea.