Skip to:
Content

Changeset 8460


Ignore:
Timestamp:
05/28/2014 09:06:07 PM (4 years ago)
Author:
johnjamesjacoby
Message:

Groups - deprecated forums file clean-up:

  • Reduce indentation.
  • Code formatting clean-up.
  • Update phpdoc blocks where necessary.
  • Whitespace clean-up.
File:
1 edited

Legend:

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

    r7624 r8460  
    2525 * @param int $group_id The group ID that the new forum should be attached to
    2626 * @param string $group_name The group name
    27  * @param string $group_description The group description
     27 * @param string $group_desc The group description
    2828 *
    2929 * @since BuddyPress (1.0)
    3030 */
    3131function groups_new_group_forum( $group_id = 0, $group_name = '', $group_desc = '' ) {
    32     global $bp;
    33 
    34     if ( empty( $group_id ) )
     32
     33    if ( empty( $group_id ) ) {
    3534        $group_id = bp_get_current_group_id();
    36 
    37     if ( empty( $group_name ) )
     35    }
     36
     37    if ( empty( $group_name ) ) {
    3838        $group_name = bp_get_current_group_name();
    39 
    40     if ( empty( $group_desc ) )
    41         $group_desc = $bp->groups->current_group->description;
    42 
    43     $forum_id = bp_forums_new_forum( array( 'forum_name' => $group_name, 'forum_desc' => $group_desc ) );
     39    }
     40
     41    if ( empty( $group_desc ) ) {
     42        $group_desc = bp_get_current_group_description();
     43    }
     44
     45    $forum_id = bp_forums_new_forum( array(
     46        'forum_name' => $group_name,
     47        'forum_desc' => $group_desc
     48    ) );
    4449
    4550    groups_update_groupmeta( $group_id, 'forum_id', $forum_id );
     
    6974     *     uninstalled)
    7075     */
    71     if ( empty( $group->enable_forum ) || !bp_is_active( 'forums' ) || ( function_exists( 'bp_forums_is_installed_correctly' ) && !bp_forums_is_installed_correctly() ) )
    72         return false;
    73 
    74     $args = array(
    75         'forum_id'      => groups_get_groupmeta( $group_id, 'forum_id' ),
    76         'forum_name'    => $group->name,
    77         'forum_desc'    => $group->description,
    78         'forum_slug'    => $group->slug
    79     );
    80 
    81     bp_forums_update_forum( apply_filters( 'groups_update_group_forum', $args ) );
     76    if ( empty( $group->enable_forum ) || !bp_is_active( 'forums' ) || ( function_exists( 'bp_forums_is_installed_correctly' ) && !bp_forums_is_installed_correctly() ) ) {
     77        return false;
     78    }
     79
     80    bp_forums_update_forum( apply_filters( 'groups_update_group_forum', array(
     81        'forum_id'   => groups_get_groupmeta( $group_id, 'forum_id' ),
     82        'forum_name' => $group->name,
     83        'forum_desc' => $group->description,
     84        'forum_slug' => $group->slug
     85    ) ) );
    8286}
    8387add_action( 'groups_details_updated', 'groups_update_group_forum' );
     
    96100 */
    97101function groups_new_group_forum_post( $post_text, $topic_id, $page = false ) {
    98     if ( empty( $post_text ) )
    99         return false;
    100 
    101     $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
    102     $topic_id  = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
    103 
    104     if ( $post_id = bp_forums_insert_post( array( 'post_text' => $post_text, 'topic_id' => $topic_id ) ) ) {
    105         $topic = bp_forums_get_topic_details( $topic_id );
    106 
    107         $activity_action = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<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>' );
    108         $activity_content = bp_create_excerpt( $post_text );
    109         $primary_link = bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/';
    110 
    111         if ( $page )
    112             $primary_link .= "?topic_page=" . $page;
    113 
    114         // Record this in activity streams
    115         groups_record_activity( array(
    116             'action'            => apply_filters_ref_array( 'groups_activity_new_forum_post_action',  array( $activity_action,  $post_id, $post_text, &$topic ) ),
    117             'content'           => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) ),
    118             'primary_link'      => apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ),
    119             'type'              => 'new_forum_post',
    120             'item_id'           => bp_get_current_group_id(),
    121             'secondary_item_id' => $post_id
    122         ) );
    123 
    124         do_action( 'groups_new_forum_topic_post', bp_get_current_group_id(), $post_id );
    125 
    126         return $post_id;
    127     }
    128 
    129     return false;
     102    if ( empty( $post_text ) ) {
     103        return false;
     104    }
     105
     106    $post_text = apply_filters( 'group_forum_post_text_before_save',     $post_text );
     107    $topic_id  = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id  );
     108    $post_id   = bp_forums_insert_post( array(
     109        'post_text' => $post_text,
     110        'topic_id'  => $topic_id
     111    ) );
     112
     113    if ( empty( $post_id ) ) {
     114        return false;
     115    }
     116
     117    $topic            = bp_forums_get_topic_details( $topic_id );
     118    $activity_action  = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<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>' );
     119    $activity_content = bp_create_excerpt( $post_text );
     120    $primary_link     = bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/';
     121
     122    if ( !empty( $page ) ) {
     123        $primary_link .= "?topic_page=" . $page;
     124    }
     125
     126    // Record this in activity streams
     127    groups_record_activity( array(
     128        'action'            => apply_filters_ref_array( 'groups_activity_new_forum_post_action',  array( $activity_action,  $post_id, $post_text, &$topic ) ),
     129        'content'           => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) ),
     130        'primary_link'      => apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ),
     131        'type'              => 'new_forum_post',
     132        'item_id'           => bp_get_current_group_id(),
     133        'secondary_item_id' => $post_id
     134    ) );
     135
     136    do_action( 'groups_new_forum_topic_post', bp_get_current_group_id(), $post_id );
     137
     138    return $post_id;
    130139}
    131140
     
    147156        return false;
    148157
    149     $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
    150     $topic_text  = apply_filters( 'group_forum_topic_text_before_save', $topic_text );
    151     $topic_tags  = apply_filters( 'group_forum_topic_tags_before_save', $topic_tags );
    152     $forum_id    = apply_filters( 'group_forum_topic_forum_id_before_save', $forum_id );
    153 
    154     if ( $topic_id = bp_forums_new_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_tags' => $topic_tags, 'forum_id' => $forum_id ) ) ) {
    155         $topic = bp_forums_get_topic_details( $topic_id );
    156 
    157         $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<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>' );
    158         $activity_content = bp_create_excerpt( $topic_text );
    159 
    160         // Record this in activity streams
    161         groups_record_activity( array(
    162             'action'            => apply_filters_ref_array( 'groups_activity_new_forum_topic_action',  array( $activity_action,  $topic_text, &$topic ) ),
    163             'content'           => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
    164             'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    165             'type'              => 'new_forum_topic',
    166             'item_id'           => bp_get_current_group_id(),
    167             'secondary_item_id' => $topic->topic_id
    168         ) );
    169 
    170         do_action_ref_array( 'groups_new_forum_topic', array( bp_get_current_group_id(), &$topic ) );
    171 
    172         return $topic;
    173     }
    174 
    175     return false;
     158    $topic_title = apply_filters( 'group_forum_topic_title_before_save',    $topic_title );
     159    $topic_text  = apply_filters( 'group_forum_topic_text_before_save',     $topic_text  );
     160    $topic_tags  = apply_filters( 'group_forum_topic_tags_before_save',     $topic_tags  );
     161    $forum_id    = apply_filters( 'group_forum_topic_forum_id_before_save', $forum_id    );
     162    $topic_id    = bp_forums_new_topic( array(
     163        'topic_title' => $topic_title,
     164        'topic_text'  => $topic_text,
     165        'topic_tags'  => $topic_tags,
     166        'forum_id'    => $forum_id
     167    ) );
     168
     169    if ( empty( $topic_id ) ) {
     170        return false;
     171    }
     172
     173    $topic            = bp_forums_get_topic_details( $topic_id );
     174    $activity_action  = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<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>' );
     175    $activity_content = bp_create_excerpt( $topic_text );
     176
     177    // Record this in activity streams
     178    groups_record_activity( array(
     179        'action'            => apply_filters_ref_array( 'groups_activity_new_forum_topic_action',  array( $activity_action,  $topic_text, &$topic ) ),
     180        'content'           => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
     181        'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
     182        'type'              => 'new_forum_topic',
     183        'item_id'           => bp_get_current_group_id(),
     184        'secondary_item_id' => $topic->topic_id
     185    ) );
     186
     187    do_action_ref_array( 'groups_new_forum_topic', array( bp_get_current_group_id(), &$topic ) );
     188
     189    return $topic;
    176190}
    177191
     
    190204 */
    191205function groups_update_group_forum_topic( $topic_id, $topic_title, $topic_text, $topic_tags = false ) {
    192     global $bp;
     206    $bp = buddypress();
    193207
    194208    $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
    195209    $topic_text  = apply_filters( 'group_forum_topic_text_before_save',  $topic_text  );
    196 
    197     if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id, 'topic_tags' => $topic_tags ) ) ) {
    198 
    199         // Get the corresponding activity item
    200         if ( bp_is_active( 'activity' ) ) {
    201             $id = bp_activity_get_activity_id( array(
    202                     'item_id'           => bp_get_current_group_id(),
    203                     'secondary_item_id' => $topic_id,
    204                     'component'         => $bp->groups->id,
    205                     'type'              => 'new_forum_topic'
    206             ) );
    207         }
    208 
    209         $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>' );
    210         $activity_content = bp_create_excerpt( $topic_text );
    211 
    212         // Record this in activity streams
    213         groups_record_activity( array(
    214             'id'                => $id,
    215             'action'            => apply_filters_ref_array( 'groups_activity_new_forum_topic_action',  array( $activity_action,  $topic_text, &$topic ) ),
    216             'content'           => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
    217             'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    218             'type'              => 'new_forum_topic',
    219             'item_id'           => (int) bp_get_current_group_id(),
    220             'user_id'           => (int) $topic->topic_poster,
    221             'secondary_item_id' => $topic->topic_id,
    222             'recorded_time '    => $topic->topic_time
     210    $topic       = bp_forums_update_topic( array(
     211        'topic_title' => $topic_title,
     212        'topic_text' => $topic_text,
     213        'topic_id' => $topic_id,
     214        'topic_tags' => $topic_tags
     215    ) );
     216
     217    if ( empty( $topic ) ) {
     218        return false;
     219    }
     220
     221    // Get the corresponding activity item
     222    if ( bp_is_active( 'activity' ) ) {
     223        $id = bp_activity_get_activity_id( array(
     224            'item_id'           => bp_get_current_group_id(),
     225            'secondary_item_id' => $topic_id,
     226            'component'         => $bp->groups->id,
     227            'type'              => 'new_forum_topic'
    223228        ) );
    224 
    225         do_action_ref_array( 'groups_update_group_forum_topic', array( &$topic ) );
    226 
    227         return $topic;
    228     }
    229 
    230     return false;
     229    }
     230
     231    $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>' );
     232    $activity_content = bp_create_excerpt( $topic_text );
     233
     234    // Record this in activity streams
     235    groups_record_activity( array(
     236        'id'                => $id,
     237        'action'            => apply_filters_ref_array( 'groups_activity_new_forum_topic_action',  array( $activity_action,  $topic_text, &$topic ) ),
     238        'content'           => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
     239        'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
     240        'type'              => 'new_forum_topic',
     241        'item_id'           => (int) bp_get_current_group_id(),
     242        'user_id'           => (int) $topic->topic_poster,
     243        'secondary_item_id' => $topic->topic_id,
     244        'recorded_time '    => $topic->topic_time
     245    ) );
     246
     247    do_action_ref_array( 'groups_update_group_forum_topic', array( &$topic ) );
     248
     249    return $topic;
    231250}
    232251
     
    245264 */
    246265function groups_update_group_forum_post( $post_id, $post_text, $topic_id, $page = false ) {
    247     global $bp;
     266    $bp = buddypress();
    248267
    249268    $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
    250269    $topic_id  = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
    251270    $post      = bp_forums_get_post( $post_id );
    252 
    253     if ( $post_id = bp_forums_insert_post( array( 'post_id' => $post_id, 'post_text' => $post_text, 'post_time' => $post->post_time, 'topic_id' => $topic_id, 'poster_id' => $post->poster_id ) ) ) {
    254         $topic = bp_forums_get_topic_details( $topic_id );
    255 
    256         $activity_action = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<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>' );
    257         $activity_content = bp_create_excerpt( $post_text );
    258         $primary_link = bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/';
    259 
    260         if ( $page )
    261             $primary_link .= "?topic_page=" . $page;
    262 
    263         // Get the corresponding activity item
    264         if ( bp_is_active( 'activity' ) ) {
    265             $id = bp_activity_get_activity_id( array(
    266                 'user_id'           => $post->poster_id,
    267                 'component'         => $bp->groups->id,
    268                 'type'              => 'new_forum_post',
    269                 'item_id'           => bp_get_current_group_id(),
    270                 'secondary_item_id' => $post_id
    271              ) );
    272         }
    273 
    274         // Update the entry in activity streams
    275         groups_record_activity( array(
    276             'id'                => $id,
    277             'action'            => apply_filters_ref_array( 'groups_activity_new_forum_post_action',  array( $activity_action,  $post_text, &$topic, &$topic ) ),
    278             'content'           => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) ),
    279             'primary_link'      => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),
     271    $post_id   = bp_forums_insert_post( array(
     272        'post_id'   => $post_id,
     273        'post_text' => $post_text,
     274        'post_time' => $post->post_time,
     275        'topic_id'  => $topic_id,
     276        'poster_id' => $post->poster_id
     277    ) );
     278
     279    if ( empty( $post_id ) ) {
     280        return false;
     281    }
     282
     283    $topic            = bp_forums_get_topic_details( $topic_id );
     284    $activity_action  = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<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>' );
     285    $activity_content = bp_create_excerpt( $post_text );
     286    $primary_link     = bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/';
     287
     288    if ( !empty( $page ) ) {
     289        $primary_link .= "?topic_page=" . $page;
     290    }
     291
     292    // Get the corresponding activity item
     293    if ( bp_is_active( 'activity' ) ) {
     294        $id = bp_activity_get_activity_id( array(
     295            'user_id'           => $post->poster_id,
     296            'component'         => $bp->groups->id,
    280297            'type'              => 'new_forum_post',
    281             'item_id'           => (int) bp_get_current_group_id(),
    282             'user_id'           => (int) $post->poster_id,
    283             'secondary_item_id' => $post_id,
    284             'recorded_time'     => $post->post_time
    285         ) );
    286 
    287         do_action_ref_array( 'groups_update_group_forum_post', array( $post, &$topic ) );
    288 
    289         return $post_id;
    290     }
    291 
    292     return false;
     298            'item_id'           => bp_get_current_group_id(),
     299            'secondary_item_id' => $post_id
     300         ) );
     301    }
     302
     303    // Update the entry in activity streams
     304    groups_record_activity( array(
     305        'id'                => $id,
     306        'action'            => apply_filters_ref_array( 'groups_activity_new_forum_post_action',  array( $activity_action,  $post_text, &$topic, &$topic ) ),
     307        'content'           => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) ),
     308        'primary_link'      => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),
     309        'type'              => 'new_forum_post',
     310        'item_id'           => (int) bp_get_current_group_id(),
     311        'user_id'           => (int) $post->poster_id,
     312        'secondary_item_id' => $post_id,
     313        'recorded_time'     => $post->post_time
     314    ) );
     315
     316    do_action_ref_array( 'groups_update_group_forum_post', array( $post, &$topic ) );
     317
     318    return $post_id;
    293319}
    294320
     
    309335 */
    310336function groups_delete_group_forum_topic( $topic_id ) {
    311     global $bp;
     337    $bp = buddypress();
    312338
    313339    // Before deleting the thread, get the post ids so that their activity items can be deleted
    314     $posts = bp_forums_get_topic_posts( array( 'topic_id' => $topic_id, 'per_page' => -1 ) );
    315 
    316     if ( bp_forums_delete_topic( array( 'topic_id' => $topic_id ) ) ) {
     340    $posts  = bp_forums_get_topic_posts( array( 'topic_id' => $topic_id, 'per_page' => -1 ) );
     341    $action = bp_forums_delete_topic( array( 'topic_id' => $topic_id ) );
     342
     343    if ( !empty( $action ) ) {
    317344        do_action( 'groups_before_delete_group_forum_topic', $topic_id );
    318345
    319346        // Delete the corresponding activity stream items
    320347        if ( bp_is_active( 'activity' ) ) {
     348
    321349            // The activity item for the initial topic
    322350            bp_activity_delete( array(
     
    339367
    340368        do_action( 'groups_delete_group_forum_topic', $topic_id );
    341 
    342         return true;
    343     }
    344 
    345     return false;
     369    }
     370
     371    return (bool) $action;
    346372}
    347373
     
    354380 *
    355381 * @param int $post_id The id of the post you want to delete
    356  * @param int $topic_id Optional. The topic to which the post belongs. This value isn't used in the
    357  *   function but is passed along to do_action() hooks.
     382 * @param int $topic_id Optional. The topic to which the post belongs. This
     383 *                      value isn't used in the function but is passed along to
     384 *                      do_action() hooks.
    358385 * @return bool True on success.
    359386 *
     
    361388 */
    362389function groups_delete_group_forum_post( $post_id, $topic_id = false ) {
    363     global $bp;
    364 
    365     if ( bp_forums_delete_post( array( 'post_id' => $post_id ) ) ) {
     390
     391    $action = bp_forums_delete_post( array( 'post_id' => $post_id ) );
     392
     393    if ( !empty( $action ) ) {
    366394        do_action( 'groups_before_delete_group_forum_post', $post_id, $topic_id );
    367395
    368396        // Delete the corresponding activity stream item
    369         if ( bp_is_active( 'activity' ) )
     397        if ( bp_is_active( 'activity' ) ) {
    370398            bp_activity_delete( array(
    371399                'item_id'           => bp_get_current_group_id(),
    372400                'secondary_item_id' => $post_id,
    373                 'component'         => $bp->groups->id,
     401                'component'         => buddypress()->groups->id,
    374402                'type'              => 'new_forum_post'
    375403            ) );
     404        }
    376405
    377406        do_action( 'groups_delete_group_forum_post', $post_id, $topic_id );
    378 
    379         return true;
    380     }
    381 
    382     return false;
     407    }
     408
     409    return (bool) $action;
    383410}
    384411
Note: See TracChangeset for help on using the changeset viewer.