Skip to:
Content

BuddyPress.org

Changeset 1291


Ignore:
Timestamp:
04/01/2009 12:51:16 PM (16 years ago)
Author:
apeatling
Message:

Fixes #624

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r1290 r1291  
    320320    global $bp;
    321321   
    322     bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );
    323     bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );
     322    bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_mod' );
     323    bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_admin' );
    324324
    325325    do_action( 'groups_screen_my_groups' );
     
    341341           
    342342            /* Record this in activity streams */
    343             groups_record_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );
     343            groups_record_activity( array( 'item_id' => $group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) );
    344344        }
    345345
     
    358358   
    359359    // Remove notifications
    360     bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'group_invite' );
     360    bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'group_invite' );
    361361
    362362    do_action( 'groups_screen_group_invites', $group_id );
     
    417417        if ( isset($_GET['new']) ) {
    418418            // Delete group request notifications for the user
    419             bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_accepted' );
    420             bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_rejected' );
    421             bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );
    422             bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );
     419            bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'membership_request_accepted' );
     420            bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'membership_request_rejected' );
     421            bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_mod' );
     422            bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'member_promoted_to_admin' );
    423423        }   
    424424
     
    816816       
    817817        // Remove any screen notifications
    818         bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'new_membership_request' );
     818        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->slug, 'new_membership_request' );
    819819       
    820820        $request_action = $bp->action_variables[1];
     
    15021502
    15031503                /* Record in activity streams */
    1504                 groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'created_group', 'is_private' => 0 ) );
     1504                groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'created_group', 'is_private' => 0 ) );
    15051505                   
    15061506                do_action( 'groups_create_group_step2_save' );
     
    16211621
    16221622        /* Record in activity streams */
    1623         groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'new_forum_post', 'is_private' => 0, 'secondary_item_id' => $forum_post['post_id'] ) );
     1623        groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'new_forum_post', 'is_private' => 0, 'secondary_item_id' => $forum_post['post_id'] ) );
    16241624       
    16251625        do_action( 'groups_new_forum_topic_post', $group_obj->id, $forum_post );
     
    16431643
    16441644        /* Record in activity streams */
    1645         groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic', 'is_private' => 0, 'secondary_item_id' => $topic['topic_id'] ) );
     1645        groups_record_activity( array( 'item_id' => $group_obj->id, 'component_name' => $bp->groups->slug, 'component_action' => 'new_forum_topic', 'is_private' => 0, 'secondary_item_id' => $topic['topic_id'] ) );
    16461646       
    16471647        do_action( 'groups_new_forum_topic', $group_obj->id, $topic );
     
    17351735}
    17361736
     1737function groups_delete_invite( $user_id, $group_id ) {
     1738    global $bp;
     1739   
     1740    $delete = BP_Groups_Member::delete_invite( $user_id, $group_id );
     1741   
     1742    if ( $delete )
     1743        bp_core_delete_notifications_for_user_by_item_id( $user_id, $group_id, $bp->groups->slug, 'group_invite' );
     1744   
     1745    return $delete;
     1746}
     1747
    17371748function groups_get_invites_for_user( $user_id = false ) {
    17381749    global $bp;
     
    18131824    if ( !$user_id )
    18141825        $user_id = $bp->loggedin_user->id;
     1826
     1827    if ( groups_check_user_has_invite( $user_id, $group_id ) )
     1828        groups_delete_invite( $user_id, $group_id );
    18151829   
    18161830    $new_member = new BP_Groups_Member;
     
    18271841
    18281842    /* Record this in activity streams */
    1829     groups_record_activity( array( 'item_id' => $new_member->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );
     1843    groups_record_activity( array( 'item_id' => $new_member->group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) );
    18301844   
    18311845    /* Modify group meta */
     
    18621876
    18631877function groups_new_wire_post( $group_id, $content ) {
    1864     global $group_obj;
     1878    global $group_obj, $bp;
    18651879
    18661880    /* Check the nonce first. */
     
    18721886        $private = true;
    18731887   
    1874     if ( $wire_post_id = bp_wire_new_post( $group_id, $content, 'groups', $private ) ) {
     1888    if ( $wire_post_id = bp_wire_new_post( $group_id, $content, $bp->groups->slug, $private ) ) {
    18751889        do_action( 'groups_new_wire_post', $group_id, $wire_post_id );
    18761890       
     
    18881902        return false;
    18891903   
    1890     if ( bp_wire_delete_post( $wire_post_id, 'groups', $table_name ) ) {       
     1904    if ( bp_wire_delete_post( $wire_post_id, $bp->groups->slug, $table_name ) ) {       
    18911905        do_action( 'groups_deleted_wire_post', $wire_post_id );
    18921906        return true;
     
    20572071
    20582072function groups_accept_membership_request( $membership_id ) {
     2073    global $bp;
    20592074   
    20602075    /* Check the nonce first. */
     
    20722087   
    20732088    /* Record this in activity streams */
    2074     groups_record_activity( array( 'item_id' => $membership->group_id, 'component_name' => 'groups', 'component_action' => 'joined_group', 'is_private' => 0 ) );
     2089    groups_record_activity( array( 'item_id' => $membership->group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'joined_group', 'is_private' => 0 ) );
    20752090
    20762091    /* Send a notification to the user. */
     
    21322147   
    21332148    // Remove the activity stream item
    2134     groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) );
     2149    groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => $bp->groups->slug, 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) );
    21352150 
    21362151    // Remove all outstanding invites for this group
  • trunk/bp-groups/bp-groups-classes.php

    r1290 r1291  
    789789        if ( !$user_id )
    790790            return false;
    791        
     791           
    792792        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );       
     793    }
     794   
     795    function delete_invite( $user_id, $group_id ) {
     796        global $wpdb, $bp;
     797       
     798        if ( !$user_id )
     799            return false;
     800       
     801        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );               
    793802    }
    794803   
Note: See TracChangeset for help on using the changeset viewer.