Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/25/2018 05:08:11 PM (8 years ago)
Author:
r-a-y
Message:

Groups: Ensure 'last_activity' meta is updated when the Activity component is disabled.

In r11924, the bp-groups-activity.php file is loaded only if the Activity
component is disabled.

However, the groups_update_last_activity() function was in this file.
This function is needed to set the last_activity group meta entry. To
ensure the last_activity group meta entry is always updated, this commit
moves the groups_update_last_activity() function over to
bp-groups-functions.php.

Anti-props r-a-y.

See #7870 (3.x branch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/src/bp-groups/bp-groups-activity.php

    r11959 r12123  
    428428
    429429/**
    430  * Update the last_activity meta value for a given group.
    431  *
    432  * @since 1.0.0
    433  *
    434  * @param int $group_id Optional. The ID of the group whose last_activity is
    435  *                      being updated. Default: the current group's ID.
    436  * @return false|null False on failure.
    437  */
    438 function groups_update_last_activity( $group_id = 0 ) {
    439 
    440     if ( empty( $group_id ) ) {
    441         $group_id = buddypress()->groups->current_group->id;
    442     }
    443 
    444     if ( empty( $group_id ) ) {
    445         return false;
    446     }
    447 
    448     groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
    449 }
    450 add_action( 'groups_join_group',           'groups_update_last_activity' );
    451 add_action( 'groups_leave_group',          'groups_update_last_activity' );
    452 add_action( 'groups_created_group',        'groups_update_last_activity' );
    453 
    454 /**
    455430 * Add an activity stream item when a member joins a group.
    456431 *
Note: See TracChangeset for help on using the changeset viewer.