Changeset 11525
- Timestamp:
- 04/05/2017 12:20:01 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-group.php
r11524 r11525 613 613 * 614 614 * @param string $slug Slug to check. 615 * @param string|bool $table_name Optional. Name of the table to check 616 * against. Default: $bp->groups->table_name. 615 * @param string|bool $table_name Deprecated. 617 616 * @return int|null Group ID if found; null if not. 618 617 */ … … 620 619 global $wpdb; 621 620 622 if ( empty( $table_name ) ) 623 $table_name = buddypress()->groups->table_name; 624 625 if ( empty( $slug ) ) 621 if ( empty( $slug ) ) { 626 622 return false; 627 628 $query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", strtolower( $slug ) ) ); 629 630 return is_numeric( $query ) ? (int) $query : $query; 623 } 624 625 $args = array( 626 'slug' => $slug, 627 'per_page' => 1, 628 'page' => 1, 629 'update_meta_cache' => false, 630 'show_hidden' => true, 631 ); 632 633 $groups = BP_Groups_Group::get( $args ); 634 635 $group_id = null; 636 if ( $groups['groups'] ) { 637 $group_id = current( $groups['groups'] )->id; 638 } 639 640 return $group_id; 631 641 } 632 642
Note: See TracChangeset
for help on using the changeset viewer.