Changeset 375 for trunk/bp-groups/bp-groups-classes.php
- Timestamp:
- 10/09/2008 04:37:49 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups/bp-groups-classes.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r373 r375 56 56 $this->enable_photos = $group->enable_photos; 57 57 $this->photos_admin_only = $group->photos_admin_only; 58 $this->date_created = $group->date_created; 58 $this->date_created = strtotime($group->date_created); 59 $this->total_member_count = groups_get_groupmeta( $this->id, 'total_member_count' ); 59 60 60 61 if ( !$group->avatar_thumb ) … … 70 71 if ( $get_user_dataset ) { 71 72 $this->user_dataset = $this->get_user_dataset(); 72 $this->total_member_count = count( $this->user_dataset ); 73 74 if ( !$this->total_member_count ) { 75 $this->total_member_count = count( $this->user_dataset ); 76 groups_update_groupmeta( $this->id, 'total_member_count', $this->total_member_count ); 77 } 73 78 } 74 79 } … … 159 164 ); 160 165 } 161 166 162 167 $result = $wpdb->query($sql); 163 168 … … 221 226 return false; 222 227 228 /* Remove groupmeta */ 229 groups_delete_groupmeta( $group_id ); 230 223 231 return true; 224 232 } 225 233 226 function group_exists( $slug ) { 227 global $wpdb, $bp; 228 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " WHERE slug = %s", $slug ) ); 234 function group_exists( $slug, $table_name = false ) { 235 global $wpdb, $bp; 236 237 if ( !$table_name ) 238 $table_name = $bp['groups']['table_name']; 239 240 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_name WHERE slug = %s", $slug ) ); 229 241 } 230 242 … … 313 325 $limit = 5; 314 326 315 return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) ); 327 return $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) ); 328 } 329 330 function get_active( $limit = 5 ) { 331 global $wpdb, $bp; 332 333 if ( !$limit ) 334 $limit = 5; 335 336 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE meta_key = 'last_activity' ORDER BY meta_value DESC LIMIT %d", $limit ) ); 337 } 338 339 function get_popular( $limit = 5 ) { 340 global $wpdb, $bp; 341 342 if ( !$limit ) 343 $limit = 5; 344 345 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE meta_key = 'total_member_count' ORDER BY meta_value DESC LIMIT %d", $limit ) ); 316 346 } 317 347 }
Note: See TracChangeset
for help on using the changeset viewer.