• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Redirect to Event after login

Redirect to Event after login 5 months 2 weeks ago #43088

  • bruntho
  • bruntho's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hello RS team,

I use RSEvents Pro and i set it up to force people to log in before to register to an event. But people were redirected to standard location after login. I was asked to improve this so i checked the view.html.php file and found this :
// If the Force login option is enabled and the current user is not logged in redirect the user
			if ($this->config->must_login && $user->get('id') == 0) {
				if ($this->config->modal == 0) {
					$app->enqueueMessage(JText::_('COM_RSEVENTSPRO_PLEASE_LOGIN'));
					$app->redirect(rseventsproHelper::route('index.php?option=com_rseventspro&layout=show&id='.rseventsproHelper::sef($this->event->id,$this->event->name),false,rseventsproHelper::itemid($this->event->id)));
				} else {
					echo rseventsproHelper::redirect(true,JText::_('COM_RSEVENTSPRO_PLEASE_LOGIN'),rseventsproHelper::route('index.php?option=com_rseventspro&layout=show&id='.rseventsproHelper::sef($this->event->id,$this->event->name),false,rseventsproHelper::itemid($this->event->id)),false,true);
					return;
				}
			}

I modified it by:
// If the Force login option is enabled and the current user is not logged in redirect the user
			if ($this->config->must_login && $user->get('id') == 0) {
				    $currentUrl = JUri::getInstance();
					$encodedUrl = base64_encode($currentUrl->toString());
					$loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . $encodedUrl);
 
				if ($this->config->modal == 0) {
					$app->enqueueMessage(JText::_('COM_RSEVENTSPRO_PLEASE_LOGIN'));
					$app->redirect($loginUrl);
				} else {
					echo rseventsproHelper::redirect(true,JText::_('COM_RSEVENTSPRO_PLEASE_LOGIN'),rseventsproHelper::route('index.php?option=com_rseventspro&layout=show&id='.rseventsproHelper::sef($this->event->id,$this->event->name),false,rseventsproHelper::itemid($this->event->id)),false,true);
					return;
				}
			}

And it works pretty well.

But when i read your code, i can see "$app->redirect(rseventsproHelper::route('index.php?..." which look like you already consider redirecting people after login.

Can you tell me why my method works and not yours ? Did i missed something in configuration ?
Is there a way to make it persistent even if i update my component ?

Thanks a lot,

Regards,

Bruntho
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!