Skip to:
Content

BuddyPress.org

Ticket #3936: 3936.01.patch

File 3936.01.patch, 2.1 KB (added by r-a-y, 13 years ago)
  • bp-groups/bp-groups-forums.php

     
    135135        $topic_text  = apply_filters( 'group_forum_topic_text_before_save',  $topic_text  );
    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>' );
    143150                $activity_content = bp_create_excerpt( $topic_text );
    144151
    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 ) ),
    149157                        'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),