So on all pages of my site including error pages I want a cookie to be created on the clients browser to define if they are logged in or not.
Just need to know what Joomla core file or plugin etc I should go to (line number) and edit to achieve this.
Here is my example code :
Cookie name is "logged_in"
Value : "1" (registered user is logged in)
Value : "0" (guest user not logged in)
$app = JFactory::getApplication();
if(JFactory::getUser()->guest) { //User is guest
$app->input->cookie->set("logged_in", "0", time() - 1, $app->get('cookie_path', '/'), $app->get('cookie_domain'), $app->isSSLConnection());
} else { //User has an account and is logged in
$app->input->cookie->set("logged_in", "1", 0, $app->get('cookie_path', '/'), $app->get('cookie_domain'), $app->isSSLConnection());
}