diff --git src/bp-groups/classes/class-bp-groups-group.php src/bp-groups/classes/class-bp-groups-group.php
index 6b35cb3..2dceead 100644
|
|
class BP_Groups_Group { |
612 | 612 | * @since 1.6.0 |
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 | */ |
619 | 618 | public static function group_exists( $slug, $table_name = false ) { |
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; |
| 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 ); |
627 | 634 | |
628 | | $query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", strtolower( $slug ) ) ); |
| 635 | $group_id = null; |
| 636 | if ( $groups['groups'] ) { |
| 637 | $group_id = current( $groups['groups'] )->id; |
| 638 | } |
629 | 639 | |
630 | | return is_numeric( $query ) ? (int) $query : $query; |
| 640 | return $group_id; |
631 | 641 | } |
632 | 642 | |
633 | 643 | /** |