$uri = JURI::getInstance();
$return = $uri->toString(array('path', 'query'));
if ($return == "")
$return = 'index.php';
$app = JFactory::getApplication();
$state = $app->getUserState('users.login.form.data', null);
$return = null;
if (JRequest::getCmd('option') == 'com_users' && JRequest::getCmd('view') == 'login' && is_array($state) && isset($state['return']))
$return = urldecode($state['return']);
if (!$return)
$return = urldecode(base64_decode($app->input->getBase64('return', '')));
if (!$return)
{
$uri = JURI::getInstance();
$return = $uri->toString(array('path', 'query'));
if ($return == "")
$return = 'index.php';
}
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="user" method="upgrade">
<name>User - Amy's Custom Redirects'</name>
<author>Geraint Brown - MindYourBizOnline</author>
<creationDate>Sep 2013</creationDate>
<copyright>(C) 2013 Geraint Brown - MindYourBizOnline. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.mind-your-biz-online.com</authorUrl>
<version>1.0</version>
<description>Redirects the user to the page they were viewing upon logging-in</description>
<files>
<filename plugin="amycustomredirects">amycustomredirects.php</filename>
<filename>index.html</filename><!-- ensure a blank index.html is placed in the root of the package too -->
</files>
<config>
<fields name="params">
</fields>
</config>
</extension>
<?php
/**
* @copyright Copyright (C) 2013 Geraint Brown - MindYourBizOnline, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* An example custom profile plugin.
*
* @package Joomla.Plugin
* @subpackage User.profile
* @version 1.6
*/
class plgUserAmyCustomRedirects extends JPlugin
{
/**
* Constructor
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* ON LOGIN
*
* Method to get the url of a user at the point of login
* Then redirect them there after successful login
*
* @param object $user The user Object
* @param array $options The login options
* @return bool true Passed Login
*/
function onUserLogin($user, $options = array())
{
// Check site - bail out if not the frontend
$app = JFactory::getApplication()
if(!$app->isSite())
return true;
/**************************
* ALEX'S CODE GOES HERE
**************************/
// Return
return true;
}
}
Join our newsletter to get alerts for Joomla releases, tips and tricks and extension updates.