Adding geolocation to session

Permalink
I'm using max mind to geolocate my site's visitors, I need that info to be persistent across all the pages they visit, so I would like to add that data to the global $_SESSION variable, what would be the best place to do that in concrete5 startup routine. I'm not sure where exactly headers are created, it would need to be before that I suppose.
Note that this is used for any visitor not registered user.

 
mkly replied on at Permalink Reply
mkly
You can do it a couple ways. The concrete5 session is started in the file /concrete/startup/session.php You can add to the session after that by creating a file /config/site_post.php and putting your code in there.

This would be after the session was created but should be before most headers.

If you are using a Package you can use the Package::on_start() method to attach to an on_start event. But if this is a one off site, using /config/site_post.php would likely be the simplest approach.

Best Regards,
Mike
http://mkly.io