I have successfully created a custom registration page in joomla 2.5 and based on the user type i want to redirect the users to different views after log in. How can i achieve this? Do i need to create an Authentication plugin or a custom log in module?
Thanks
Try this,
Joomla have a module for login purpose you can use that or just check com_users/view/
for redirecting after successful login in joomla from any page you can use
<input type="hidden" name="return" value="<?php echo base64_encode("your return url"); ?>" />
This hidden field should found inside your login module form some thing like below.
<form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post">
<fieldset>
<?php foreach ($this->form->getFieldset('credentials') as $field): ?>
<?php if (!$field->hidden): ?>
<div class="login-fields"><?php echo $field->label; ?>
<?php echo $field->input; ?></div>
<?php endif; ?>
<?php endforeach; ?>
<button type="submit" class="button"><?php echo JText::_('JLOGIN'); ?></button>
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url',$this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
You just need to put your return url in the hidden field with base64_encoded
Joomla will redirect to this url when the login was success.
This is not a core file editing if you required to redirect after authentication, that means you already providing a login form that should have hidden field like return or just add it.
In another case if you want to know just the redirection option.
$mainframe = JFactory::getApplication();
$mainframe->redirect("your redirect url",'message' ,'message type');
Hope its helps...