function groups_update_group_forum_topic($topic_id, $topic_title, $topic_text, $topic_tags = false)
{
    global $bp;
    $topic_title = apply_filters('group_forum_topic_title_before_save', $topic_title);
    $topic_text = apply_filters('group_forum_topic_text_before_save', $topic_text);
    if ($topic = bp_forums_update_topic(array('topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id, 'topic_tags' => $topic_tags))) {
        // Update the activity stream item
        if (bp_is_active('activity')) {
            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'));
        }
        $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>');
        $activity_content = bp_create_excerpt($topic_text);
        // Record this in activity streams
        groups_record_activity(array('action' => apply_filters_ref_array('groups_activity_new_forum_topic_action', array($activity_action, $topic_text, &$topic)), 'content' => apply_filters_ref_array('groups_activity_new_forum_topic_content', array($activity_content, $topic_text, &$topic)), 'primary_link' => apply_filters('groups_activity_new_forum_topic_primary_link', bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/'), 'type' => 'new_forum_topic', 'item_id' => (int) $bp->groups->current_group->id, 'user_id' => (int) $topic->topic_poster, 'secondary_item_id' => $topic->topic_id, 'recorded_time ' => $topic->topic_time));
        do_action_ref_array('groups_update_group_forum_topic', array(&$topic));
        return $topic;
    }
    return false;
}
/**
 * Update an existing group forum topic.
 *
 * Uses the bundled version of bbPress packaged with BuddyPress.
 *
 * @since BuddyPress (1.1.0)
 *
 * @param int    $topic_id    The topic ID of the existing forum topic.
 * @param string $topic_title The title for the forum topic.
 * @param string $topic_text  The text for the forum topic.
 * @param mixed  $topic_tags  A comma-delimited string of topic tags. Optional.
 *
 * @return mixed The topic object on success. Boolean false on failure.
 */
function groups_update_group_forum_topic($topic_id, $topic_title, $topic_text, $topic_tags = false)
{
    $bp = buddypress();
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $topic_title = apply_filters('group_forum_topic_title_before_save', $topic_title);
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $topic_text = apply_filters('group_forum_topic_text_before_save', $topic_text);
    $topic = bp_forums_update_topic(array('topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id, 'topic_tags' => $topic_tags));
    if (empty($topic)) {
        return false;
    }
    // Get the corresponding activity item
    if (bp_is_active('activity')) {
        $id = bp_activity_get_activity_id(array('item_id' => bp_get_current_group_id(), 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic'));
    }
    $activity_action = sprintf(__('%1$s edited the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink($topic->topic_poster), '<a href="' . bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic->topic_slug . '/">' . esc_attr($topic->topic_title) . '</a>', '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . esc_attr(bp_get_current_group_name()) . '</a>');
    $activity_content = bp_create_excerpt($topic_text);
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $action = apply_filters_ref_array('groups_activity_new_forum_topic_action', array($activity_action, $topic_text, &$topic));
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $content = apply_filters_ref_array('groups_activity_new_forum_topic_content', array($activity_content, $topic_text, &$topic));
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $primary_link = apply_filters('groups_activity_new_forum_topic_primary_link', bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic->topic_slug . '/');
    groups_record_activity(array('id' => $id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'type' => 'new_forum_topic', 'item_id' => (int) bp_get_current_group_id(), 'user_id' => (int) $topic->topic_poster, 'secondary_item_id' => $topic->topic_id, 'recorded_time ' => $topic->topic_time));
    /**
     * Fires after the update of a group forum topic.
     *
     * @since BuddyPress (1.1.0)
     *
     * @param object $topic Object holding current topic being updated. Passed by reference.
     */
    do_action_ref_array('groups_update_group_forum_topic', array(&$topic));
    return $topic;
}