Fair point, I've done this now (the redirect goes to my calendar home as opposed to a 404 if they are already logged in and try a missing event URL):
if (empty($data)) {
//Check if user is logged in
$uid = $user->id;
if ($uid == 0) {
$app =& JFactory::getApplication();
$app->redirect('index.php?option=com_users&view=login&return=' . base64_encode('index.php?option=com_jem&view=event&id='.$pk));
} else {
$app =& JFactory::getApplication();
$app->redirect('calendar');
//throw new Exception(JText::_('COM_JEM_EVENT_ERROR_EVENT_NOT_FOUND'), 404);
}
}
The following user(s) said Thank You:
depebo
Please Log in or Create an account to join the conversation.