Changeset 7182 for trunk/bp-groups/bp-groups-classes.php
- Timestamp:
- 06/07/2013 02:06:51 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r7180 r7182 1226 1226 self::refresh_total_group_count_for_user( $this->user_id ); 1227 1227 1228 // Update the group's member count 1229 self::refresh_total_member_count_for_group( $this->group_id ); 1230 1228 1231 do_action_ref_array( 'groups_member_after_save', array( &$this ) ); 1229 1232 … … 1256 1259 1257 1260 function ban() { 1258 1259 1261 if ( !empty( $this->is_admin ) ) 1260 1262 return false; … … 1263 1265 $this->is_banned = 1; 1264 1266 1265 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );1266 1267 1267 return $this->save(); 1268 1268 } 1269 1269 1270 1270 function unban() { 1271 1272 1271 if ( !empty( $this->is_admin ) ) 1273 1272 return false; 1274 1273 1275 1274 $this->is_banned = 0; 1276 1277 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) + 1 ) );1278 1275 1279 1276 return $this->save(); … … 1299 1296 return false; 1300 1297 1301 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );1302 1303 1298 // Update the user's group count 1304 1299 self::refresh_total_group_count_for_user( $this->user_id ); 1305 1300 1301 // Update the group's member count 1302 self::refresh_total_member_count_for_group( $this->group_id ); 1303 1306 1304 return $result; 1307 1305 } … … 1309 1307 /** Static Methods ********************************************************/ 1310 1308 1309 /** 1310 * Refresh the total_group_count for a user 1311 * 1312 * @since BuddyPress (1.8) 1313 * @param int $user_id 1314 * @return bool True on success 1315 */ 1311 1316 public static function refresh_total_group_count_for_user( $user_id ) { 1312 bp_update_user_meta( $user_id, 'total_group_count', (int) self::total_group_count( $user_id ) ); 1317 return bp_update_user_meta( $user_id, 'total_group_count', (int) self::total_group_count( $user_id ) ); 1318 } 1319 1320 /** 1321 * Refresh the total_member_count for a group 1322 * 1323 * @since BuddyPress (1.8) 1324 * @param int $group_id 1325 * @return bool True on success 1326 */ 1327 public static function refresh_total_member_count_for_group( $group_id ) { 1328 return groups_update_groupmeta( $group_id, 'total_member_count', (int) BP_Groups_Group::get_total_member_count( $group_id ) ); 1313 1329 } 1314 1330 … … 1320 1336 // Update the user's group count 1321 1337 self::refresh_total_group_count_for_user( $user_id ); 1338 1339 // Update the group's member count 1340 self::refresh_total_member_count_for_group( $group_id ); 1322 1341 1323 1342 return $remove;
Note: See TracChangeset
for help on using the changeset viewer.