So I was able to edit the query to only pull the events from a group (that was easy), but I am still struggling with how to use the Group id. In the module files, which single file is called first? I presumed it was mod_geommunity3js.php, where I inserted the following code before line 18:
$groupId = JRequest::getInt('groupid', '');
$session = JFactory::getSession();
$session->set('groupId', $groupId);
......so this sets the Group Id to the session (which I tested and confirmed it is being correctly set). I then added the code in bold to the getEventmarkers() function to the eventsventmarkers.php in the component file:
public function getEventmarkers()
{
$db = JFactory::getDBO();
$jinput = JFactory::getApplication()->input;
$mapid = $jinput->get('mapid');
$a = $swLat = $jinput->get('swLat');
$b = $swLng = $jinput->get('swLng');
$c = $neLat = $jinput->get('neLat');
$d = $neLng = $jinput->get('neLng');
$condition1 = $a < $c ? "latitude BETWEEN $a AND $c":"latitude BETWEEN $c AND $a";
$condition2 = $b < $d ? "longitude BETWEEN $b AND $d":"longitude BETWEEN $d AND $b";
$session = JFactory::getSession();
$groupId = $session->get('groupId');
$q ="SELECT id , title , latitude , longitude
FROM #__community_events
WHERE published='1' AND enddate>=NOW()
AND ( $condition1 ) AND ( $condition2 ) AND contentid=$groupId";
$db->setQuery($q);
$markers = $db->loadObjectList();
return $markers;
}
.......Unfortunately, the session isn't being referenced in the eventsmarkers file. I'm wondering if the eventsmarker is somehow being called before the session is being set in the mod_geommunity3js.php file? I browsed some of the other files and couldn't find where the eventsmarker.php file was called.
So my question is this, is some other Geommunity file first called when the page loads before the mod_geommunity3js.php file? If so, which one?
Thanks for the advice-
Tim