Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 4 years ago

#6158 closed enhancement (fixed)

allow removing membership activity from the criteria for marking a group "recently active"

Reported by: jreeve Owned by: r-a-y
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch
Cc: jon.reeve@…

Description

Groups will get marked as recently active when they've had membership changes, but some users might not consider those types of activities notable as recent activities. On our BP install, we have lots of group membership changes, especially from new users, and that floods the list of recently active groups, thereby obscuring more significant activity like forum posts. We'd like to use our Recently Active Groups widget to highlight groups with lots of significant activity, not just membership changes.

One solution might be to remove the call to groups_update_groupmeta from the function groups_join_group, and to add the already-existing function 'groups_update_last_activity there, like this: add_action( 'groups_join_group', 'groups_update_last_activity' );. That way, users that want to prevent group membership activities from marking groups as active will be able to remove that action, like they're already able to do with groups_leave_group, groups_created_group`, etc.

Unless there's a reason groups_join_group handles updating this metadata with groups_update_groupmeta, instead of calling groups_update_last_activity?

I'll see if I can add a patch for this.

Attachments (2)

6158.patch (1.1 KB) - added by jreeve 5 years ago.
properly hook groups_update_last_activity instead of calling groups_update_groupmeta
6158.02.patch (1.4 KB) - added by r-a-y 4 years ago.

Download all attachments as: .zip

Change History (11)

#1 @jreeve
5 years ago

  • Component changed from Core to Groups

#2 @jreeve
5 years ago

  • Cc jon.reeve@… added

#3 @r-a-y
5 years ago

  • Keywords close added

I would say this is custom functionality based on your site's needs.

You should be able to delete the last activity groupmeta when a new group is created or when a member joins a group on the 'groups_create_group' and `'groups_join_group' hooks.

#4 @r-a-y
5 years ago

  • Keywords needs-patch added; close removed
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

Update: Apologies for not reading the ticket thoroughly. I see what you mean now in groups_join_group() and groups_create_group() functions.

You want to move the groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() ) function call so it is hookable similar to groups_update_last_activity().

We can definitely do this.

@jreeve
5 years ago

properly hook groups_update_last_activity instead of calling groups_update_groupmeta

#5 @jreeve
5 years ago

  • Keywords needs-patch removed

#6 @jreeve
5 years ago

Above is a patch that hooks groups_update_last_activity into the action groups_join_group, instead of manually calling groups_update_groupmeta.

#7 @r-a-y
5 years ago

  • Milestone changed from Future Release to 2.3
  • Owner set to r-a-y
  • Status changed from new to assigned

Thanks jreeve.

@r-a-y
4 years ago

#8 @r-a-y
4 years ago

  • Keywords has-patch added

02.patch refreshes Jonathan's initial patch and removes the 'last_activity' update meta call in groups_create_group() as the 'last_activity' timestamp is already updated on the 'groups_created_group' hook (this merges in the report in #6164 by Jonathan as well):

https://buddypress.trac.wordpress.org/browser/tags/2.2.3.1/src/bp-groups/bp-groups-functions.php#L170
https://buddypress.trac.wordpress.org/browser/tags/2.2.3.1/src/bp-groups/bp-groups-activity.php?marks=375#L355

Last edited 4 years ago by r-a-y (previous) (diff)

#9 @r-a-y
4 years ago

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

In 9815:

Groups: Streamline last activity update meta calls.

This commit:

  • Removes the hardcoded 'last_activity' call in groups_join_group() and uses the groups_update_last_activity() on the 'groups_join_group' hook. This mirrors last activity update calls on other group actions (leave, created).
  • Removes the hardcoded 'last_activity' call in groups_create_group(). The last activity is already updated on the 'groups_created_group' hook. No need to update twice!

Props jreeve.

Fixes #6158.

Note: See TracTickets for help on using tickets.