public static function getPopularGroups($limit=0)
	{
		//database object
		$database = \App::get('db');

		//query
		$sql = "SELECT g.gidNumber, g.cn, g.description, g.public_desc,
				(SELECT COUNT(*) FROM `#__xgroups_members` AS gm WHERE gm.gidNumber=g.gidNumber) AS members
				FROM `#__xgroups` AS g
				WHERE g.type IN (1, 3)
				AND g.published=1
				AND g.approved=1
				AND g.discoverability=0
				ORDER BY members DESC";

		//do we want to limit return
		if ($limit > 0)
		{
			$sql .= "  LIMIT {$limit}";
		}

		//execute query and return result
		$database->setQuery( $sql );
		if (!$database->getError())
		{
			return $database->loadObjectList();
		}
	}
public static function getPopularGroups($limit=0)
	{
		//database object
		$database = \App::get('db');

		//query
		$sql = "SELECT g.gidNumber, g.cn, g.description, g.public_desc,
				(SELECT COUNT(*) FROM `#__xgroups_members` AS gm WHERE gm.gidNumber=g.gidNumber) AS members
				FROM `#__xgroups` AS g
				WHERE g.type IN (1, 3)
				AND g.published=1
				AND g.approved=1
				AND g.discoverability=0
				ORDER BY members DESC";

		//do we want to limit return
		if ($limit > 0)
		{
			$sql .= "  LIMIT {$limit}";
		}

		//execute query and return result
		$database->setQuery( $sql );
		if (!$database->getError())
		{
			return $database->loadObjectList();
		}
	}
public static function getPopularGroups ( $ limit = 0 ) { //database object $ database = \ App :: get ( 'db' ) ; //query $ sql = "SELECT g.gidNumber, g.cn, g.description, g.public_desc,
				(SELECT COUNT(*) FROM `#__xgroups_members` AS gm WHERE gm.gidNumber=g.gidNumber) AS members
				FROM `#__xgroups` AS g
				WHERE g.type IN (1, 3)
				AND g.published=1
				AND g.approved=1
				AND g.discoverability=0
				ORDER BY members DESC" ; //do we want to limit return if ( $ limit > 0 ) { $ sql .= "  LIMIT {$limit}" ; } //execute query and return result $ database -> setQuery ( $ sql ) ; if ( ! $ database -> getError ( ) ) { return $ database -> loadObjectList ( ) ; } }
Get popular groups

@param   integer  $limit
@return  array
Get popular groups