Changeset 2556
- Timestamp:
- 02/03/2010 10:44:26 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r2548 r2556 2257 2257 do_action( 'groups_ban_member', $user_id, $group_id ); 2258 2258 2259 return $member->ban(); 2259 if ( !$member->ban() ) 2260 return false; 2261 2262 update_usermeta( $user_id, 'total_group_count', (int)$total_count - 1 ); 2260 2263 } 2261 2264 -
trunk/bp-groups/bp-groups-classes.php
r2550 r2556 121 121 global $wpdb, $bp; 122 122 123 / / Delete groupmeta for the group123 /* Delete groupmeta for the group */ 124 124 groups_delete_groupmeta( $this->id ); 125 125 126 // Modify group count usermeta for members 127 for ( $i = 0; $i < count($this->user_dataset); $i++ ) { 128 $user = $this->user_dataset[$i]; 129 130 $total_count = get_usermeta( $user->user_id, 'total_group_count' ); 131 132 if ( $total_count != '' ) { 133 update_usermeta( $user->user_id, 'total_group_count', (int)$total_count - 1 ); 134 } 135 136 // Now delete the group member record 137 BP_Groups_Member::delete( $user->user_id, $this->id, false ); 138 } 126 /* Fetch the user IDs of all the members of the group */ 127 $user_ids = BP_Groups_Member::get_group_member_ids( $this->id ); 128 $user_ids = implode( ',', (array)$user_ids ); 129 130 /* Modify group count usermeta for members */ 131 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->groups->table_name_groupmeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )" ) ); 132 133 /* Now delete all group member entries */ 134 BP_Groups_Member::delete_all( $this->id ); 139 135 140 136 do_action( 'bp_groups_delete_group', $this ); … … 724 720 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) ); 725 721 722 $group_count = get_usermeta( $this->user_id, 'total_group_count' ); 723 if ( !empty( $group_count ) ) 724 update_usermeta( $this->user_id, 'total_group_count', (int)$group_count - 1 ); 725 726 726 return $this->save(); 727 727 } … … 734 734 735 735 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) + 1 ) ); 736 update_usermeta( $this->user_id, 'total_group_count', (int)get_usermeta( $this->user_id, 'total_group_count' ) + 1 ); 736 737 737 738 return $this->save(); … … 936 937 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 937 938 } 939 } 940 941 function get_group_member_ids( $group_id ) { 942 global $bp, $wpdb; 943 944 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) ); 938 945 } 939 946 … … 996 1003 997 1004 return array( 'members' => $members, 'count' => $total_member_count ); 1005 } 1006 1007 function delete_all( $group_id ) { 1008 global $wpdb, $bp; 1009 1010 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) ); 998 1011 } 999 1012 -
trunk/bp-groups/bp-groups-notifications.php
r2537 r2556 7 7 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . __( 'Group Details Updated', 'buddypress' ); 8 8 9 foreach ( $group->user_dataset as $user ) { 10 if ( 'no' == get_usermeta( $user->user_id, 'notification_groups_group_updated' ) ) continue; 11 12 $ud = bp_core_get_core_userdata( $user->user_id ); 9 $user_ids = BP_Groups_Member::get_group_member_ids( $this->id ); 10 foreach ( $user_ids as $user_id ) { 11 if ( 'no' == get_usermeta( $user_id, 'notification_groups_group_updated' ) ) continue; 12 13 $ud = bp_core_get_core_userdata( $user_id ); 13 14 14 15 // Set up and send the message … … 16 17 17 18 $group_link = site_url( $bp->groups->slug . '/' . $group->slug ); 18 $settings_link = bp_core_get_user_domain( $user ->user_id ) . 'settings/notifications/';19 $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications/'; 19 20 20 21 $message = sprintf( __(
Note: See TracChangeset
for help on using the changeset viewer.