Skip to content

Instantly share code, notes, and snippets.

@elinw
Created May 5, 2015 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elinw/6735616d3e0e0cae823c to your computer and use it in GitHub Desktop.
Save elinw/6735616d3e0e0cae823c to your computer and use it in GitHub Desktop.
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
// Could possibly be added to the civicrm system plugin
/**
* This plugin will redirect from a com_user page to a civicrm registration profile.
*/
class plgSystemCiviregistration extends JPlugin
{
/**
* Constructor
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function onAfterRoute()
{
//Compare the request to the core registration request and if they are the same redirect
$app = JFactory::getApplication();
// Would want to change JRequest to JInput
if ((JRequest::getCmd('option')=='com_user') &&
((JRequest::getCmd('view')=='register')||(JRequest::getCmd('task')=='register') ))
{ // Redirect to the alternate registration page
// Note you need this param in the sml
$app->redirect($this->params->get('altregurl', 'index.php'));
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment