help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

Mailer plugin and site login

Mailer plugin and site login

5 years 11 months ago
#25536
Hi

I have Joomla 3.8 and JEM 2.2.3 installed with the mailer plugin active

Everything works great and notifications are sent as they should. The email notification sent will include a link such as this
www.north-halifax-taekwondo.co.uk/index.php?option=com_jem&view=event&id=11:north-west-open-championships

JEM is included in am area whose access is controlled by an ACL. If the user clicks on the link and they are NOT logged into the site, they get a 404 error message. If they are logged in, they get to the event no problems.

How can I amend the link to just show the site name, i.e. www.north-halifax-taekwondo.co.uk . This will allow the user to log in and manually navigate to the event.

Alternativley, can it be set so that they go to a log in page then once logged in, are redirected to the event?

I would point out, im not too comp savey, i only know what i have read, so if i need to amend any coding, would it be possible to give me a step by step blow on how to do it please?

Thanks

Neil

Please Log in or Create an account to join the conversation.

Re: Mailer plugin and site login

5 years 7 months ago
#26114
I have this exact same issue - did you resolve the login aspect, I want the link to prompt for login and go to the event.

Please Log in or Create an account to join the conversation.

Re: Mailer plugin and site login

5 years 7 months ago
#26115
Sounds like a good idea to me.
Here is some information if someone want to take it further stackoverflow.com/questions/25659505/joomla-redirect-to-login-page-if-user-is-not-logged-in-and-back-in-custom-compo
I think a change to the event model will be required to check if error is caused by insufficient user permissions and then redirect to login page instead of throwing exception and 404 page.
The following user(s) said Thank You: david.obrien

Please Log in or Create an account to join the conversation.

Re: Mailer plugin and site login

5 years 7 months ago
#26137
I'm not a great developer, I'm looking at the options listed, and think this one would help:

$url = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode('YOUR COMPONENT VIEW URL HERE')
$this->setRedirect($url);
return $this;

But which file should it go in?

Please Log in or Create an account to join the conversation.

Re: Mailer plugin and site login

5 years 7 months ago
#26138
david.obrien wrote: I'm not a great developer

Maybe I'm better than I thought :)

In httpdocs/components/com_jem/models/event.php (line 151) I changed it to:

if (empty($data)) {
$app =& JFactory::getApplication();
$app->redirect('index.php?option=com_users&view=login&return=' . base64_encode('index.php?option=com_jem&view=event&id='.$pk));
//throw new Exception(JText::_('COM_JEM_EVENT_ERROR_EVENT_NOT_FOUND'), 404);
}

And it appears to work a treat for me - any issues with what I have done?

Thanks,
David

Please Log in or Create an account to join the conversation.

Re: Mailer plugin and site login

5 years 7 months ago
#26142
That should work for most cases. Only one small issue I can see: $data can be empty due to user permissions or simply because event does not exist. If you direct user to login with redirect to the same non-existing event you may never get the actual 404. Solution: test if the user is already logged on before sending them to login page - if user is already logged on show the 404 error. To test create a URL with not existing event id.
The following user(s) said Thank You: david.obrien

Please Log in or Create an account to join the conversation.

Time to create page: 0.556 seconds