Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)
  • @seandkendle

    Participant

    What about: BP_Groups_Group::group_exists( $group_slug )?

    
    	 /**
    	 * Get whether a group exists for a given slug.
    	 *
    	 * @since BuddyPress 1.6.0
    	 *
    	 * @param string      $slug       Slug to check.
    	 * @param string|bool $table_name Deprecated.
    	 * @return int|null Group ID if found; null if not.
    	 */
    	public static function group_exists( $slug, $table_name = false ) {
    		global $wpdb;
    
    		if ( empty( $slug ) ) {
    			return false;
    		}
    
    		$args = array(
    			'slug'              => $slug,
    			'per_page'          => 1,
    			'page'              => 1,
    			'update_meta_cache' => false,
    			'show_hidden'       => true,
    		);
    
    		$groups = self::get( $args );
    
    		$group_id = null;
    		if ( $groups['groups'] ) {
    			$group_id = current( $groups['groups'] )->id;
    		}
    
    		return $group_id;
    	}

    class-bp-groups-group.php line 715

Viewing 1 replies (of 1 total)
Skip to toolbar