Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/09/2015 08:56:45 AM (11 years ago)
Author:
imath
Message:

Only create a single activity when a friendship is created and make sure to display it on each involved user personal activities.

When a friendship is created, a single public activity will be created. Thanks to the new BP_Activity_Query class introduced in version 2.2, we are able to fetch this activity on each involved user personal activity stream.
Once BuddyPress will be updated to 2.2, all hide_sitewide activities related to a created friendship will be removed as they are not necessary anymore.

Fixes #6040

props boonebgorges, r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-update.php

    r9273 r9326  
    400400 * - Add messages meta table
    401401 * - Update the component field of the 'new members' activity type
     402 * - Clean up hidden friendship activities
    402403 *
    403404 * @since BuddyPress (2.2.0)
     
    410411    if ( bp_is_active( 'activity' ) ) {
    411412        bp_migrate_new_member_activity_component();
     413
     414        if ( bp_is_active( 'friends' ) ) {
     415            bp_cleanup_friendship_activities();
     416        }
    412417    }
    413418}
     
    450455
    451456/**
     457 * Remove all hidden friendship activities
     458 *
     459 * @since BuddyPress (2.2.0)
     460 *
     461 * @uses bp_activity_delete() to delete the corresponding friendship activities
     462 */
     463function bp_cleanup_friendship_activities() {
     464    bp_activity_delete( array(
     465        'component'     => buddypress()->friends->id,
     466        'type'          => 'friendship_created',
     467        'hide_sitewide' => true,
     468    ) );
     469 }
     470
     471/**
    452472 * Redirect user to BP's What's New page on first page load after activation.
    453473 *
Note: See TracChangeset for help on using the changeset viewer.