Skip to:
Content

BuddyPress.org

Changeset 5642


Ignore:
Timestamp:
01/21/2012 10:41:47 AM (15 years ago)
Author:
djpaul
Message:

Prevent duplicate activity emails when updating group forum topics. Fixes #3936, superprops r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-forums.php

    r5431 r5642  
    136136
    137137        if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id, 'topic_tags' => $topic_tags ) ) ) {
    138                 // Update the activity stream item
    139                 if ( bp_is_active( 'activity' ) )
    140                         bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
     138
     139                // Get the corresponding activity item
     140                if ( bp_is_active( 'activity' ) ) {
     141                        $id = bp_activity_get_activity_id( array(
     142                                        'item_id'           => $bp->groups->current_group->id,
     143                                        'secondary_item_id' => $topic_id,
     144                                        'component'         => $bp->groups->id,
     145                                        'type'              => 'new_forum_topic'
     146                        ) );
     147                }
    141148
    142149                $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
     
    145152                // Record this in activity streams
    146153                groups_record_activity( array(
     154                        'id'                => $id,
    147155                        'action'            => apply_filters_ref_array( 'groups_activity_new_forum_topic_action',  array( $activity_action,  $topic_text, &$topic ) ),
    148156                        'content'           => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
Note: See TracChangeset for help on using the changeset viewer.