Skip to:
Content

BuddyPress.org

Changeset 1763 for trunk/bp-groups.php


Ignore:
Timestamp:
09/02/2009 08:20:16 PM (15 years ago)
Author:
apeatling
Message:

Fixes #820

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r1760 r1763  
    460460            else if ( 'hidden' == $_POST['group-status'] )
    461461                $group_status = 'hidden';
    462            
    463             /* Once we get to the second step, record the group creation in the activity stream. As we now know the actual status of the group */
    464             groups_record_activity( array(
    465                 'content' => sprintf( __( '%s created the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ),
    466                 'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    467                 'component_action' => 'created_group',
    468                 'item_id' => $bp->groups->current_group->id,
    469                 'user_id' => $user_id
    470             ) );
    471462       
    472463            if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_wire' => $group_enable_wire, 'enable_forum' => $group_enable_forum ) ) ) {
     
    499490            unset( $bp->groups->current_create_step );
    500491            unset( $bp->groups->completed_create_steps );
     492           
     493            /* Once we compelete all steps, record the group creation in the activity stream. */
     494            groups_record_activity( array(
     495                'content' => sprintf( __( '%s created the group %s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ),
     496                'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
     497                'component_action' => 'created_group',
     498                'item_id' => $bp->groups->new_group_id
     499            ) );
    501500           
    502501            bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     
    12281227    if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {
    12291228       
    1230         if ( !$bp->is_item_admin )
     1229        if ( !$bp->is_item_admin && !is_site_admin() )
    12311230            return false;
    12321231       
     
    12371236       
    12381237            // Group admin has deleted the group, now do it.
    1239             if ( !groups_delete_group( $_POST['group-id']) ) {
     1238            if ( !groups_delete_group( $_POST['group-id'] ) ) {
    12401239                bp_core_add_message( __( 'There was an error deleting the group, please try again.', 'buddypress' ), 'error' );
    12411240            } else {
     
    14201419    $r = wp_parse_args( $args, $defaults );
    14211420    extract( $r, EXTR_SKIP );   
    1422    
     1421
    14231422    return bp_activity_add( array( 'user_id' => $user_id, 'content' => $content, 'primary_link' => $primary_link, 'component_name' => $component_name, 'component_action' => $component_action, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    14241423}
     
    16881687        return false;
    16891688
    1690     /* Delete the activity stream item */
     1689    /* Delete all group activity from activity streams */
    16911690    if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
    1692         bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group' ) );
    1693     }   
     1691        bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => $bp->groups->id ) );
     1692    }
    16941693 
    16951694    // Remove all outstanding invites for this group
     
    19891988            'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    19901989            'component_action' => 'new_wire_post',
    1991             'item_id' => $wire_post->item_id,
    1992             'secondary_item_id' => $bp->groups->current_group->id
     1990            'item_id' => $bp->groups->current_group->id,
     1991            'secondary_item_id' => $wire_post->item_id
    19931992        ) );
    19941993
     
    20502049            'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    20512050            'component_action' => 'new_forum_post',
    2052             'item_id' => $topic_id,
     2051            'item_id' => $bp->groups->current_group->id,
    20532052            'secondary_item_id' => $forum_post->id
    20542053        ) );
     
    20762075            'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    20772076            'component_action' => 'new_forum_topic',
    2078             'item_id' => $topic->topic_id,
    2079             'secondary_item_id' => $bp->groups->current_group->id
     2077            'item_id' => $bp->groups->current_group->id,
     2078            'secondary_item_id' => $topic->topic_id
    20802079        ) );
    20812080       
     
    21032102            'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    21042103            'component_action' => 'new_forum_topic',
    2105             'item_id' => (int)$topic->topic_id,
     2104            'item_id' => (int)$bp->groups->current_group->id,
    21062105            'user_id' => (int)$topic->topic_poster,
    2107             'secondary_item_id' => $bp->groups->current_group->id,
     2106            'secondary_item_id' => $topic->topic_id,
    21082107            'recorded_time' => bb_gmtstrtotime( $topic->topic_time )
    21092108        ) );
     
    21442143
    21452144        /* Update the activity stream item */
    2146         bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'secondary_item_id' => $post_id, 'component_name' => 'groups', 'component_action' => 'new_forum_post' ) );
     2145        bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component_name' => 'groups', 'component_action' => 'new_forum_post' ) );
    21472146       
    21482147        $activity_content = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug .'">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     
    21542153            'primary_link' => bp_get_group_permalink( $bp->groups->current_group ),
    21552154            'component_action' => 'new_forum_post',
    2156             'item_id' => $topic_id,
     2155            'item_id' => $bp->groups->current_group->id,
    21572156            'secondary_item_id' => $post_id,
    21582157            'recorded_time' => bb_gmtstrtotime( $post->post_time )
     
    25612560/*** Group Cleanup Functions ****************************************************/
    25622561
    2563 function groups_remove_data( $user_id ) {
     2562function groups_remove_data_for_user( $user_id ) {
    25642563    BP_Groups_Member::delete_all_for_user($user_id);
    25652564   
    2566     do_action( 'groups_remove_data', $user_id );
    2567 }
    2568 add_action( 'wpmu_delete_user', 'groups_remove_data', 1 );
    2569 add_action( 'delete_user', 'groups_remove_data', 1 );
     2565    do_action( 'groups_remove_data_for_user', $user_id );
     2566}
     2567add_action( 'wpmu_delete_user', 'groups_remove_data_for_user', 1 );
     2568add_action( 'delete_user', 'groups_remove_data_for_user', 1 );
    25702569
    25712570function groups_clear_group_object_cache( $group_id ) {
Note: See TracChangeset for help on using the changeset viewer.