Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#3430 closed enhancement (fixed)

Groups Members - add Order by: Group Activity

Reported by: slaffik's profile slaFFik Owned by: slaffik's profile 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)

3430.patch (2.5 KB) - added by imath 11 years ago.
3430.02.patch (4.8 KB) - added by imath 11 years ago.
3430.03.patch (5.2 KB) - added by imath 11 years ago.

Download all attachments as: .zip

Change History (14)

#1 @DJPaul
13 years ago

  • Milestone changed from Awaiting Review to Future Release

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.

#2 @slaFFik
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 @boonebgorges
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.

@imath
11 years ago

#4 @imath
11 years ago

  • Keywords has-patch added; needs-patch removed

After some tests, i'm suggesting 3430.patch.

#5 follow-up: @boonebgorges
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 @imath
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!!)

Version 0, edited 11 years ago by imath (next)

@imath
11 years ago

#7 @boonebgorges
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 @imath
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)

@imath
11 years ago

#9 @boonebgorges
11 years ago

Excellent, thanks! I am going to put in a few more sanity checks and sanitization bits. This is a nice little improvement.

#10 @boonebgorges
11 years ago

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

In 8397:

Introduce 'group_activity' sort order for group member queries

Adds a new 'Group Activity' option to the 'Order By' dropdown on group member
listings, so that you can see who has most recently been active in that
specific group.

Fixes #3430

Props imath

#11 @imath
11 years ago

In 8398:

Update pot file after 'group_activity' new member sort order introduction

The new sort order for group member queries generated a new string 'Group Activity'. As a result using 'grunt build-commit' generates a new buddypress.pot file.

see #3430'

Note: See TracTickets for help on using tickets.