*
*/
function __construct() {
+ /**
+ * deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
+ * functions and leave the codebase oblivious to the type of CMS
+ * @deprecated
+ * @var bool
+ */
$this->is_drupal = FALSE;
}
$ufName = CRM_Utils_Type::escape($ufName, 'String');
$values = array();
- $user = &JUser::getInstance($ufID);
+ $user = JUser::getInstance($ufID);
$values['email'] = $ufName;
$user->bind($values);
//include additional files required by Joomla 3.2.1+
if ( version_compare(JVERSION, '3.2.1', 'ge') ) {
- require $joomlaBase . '/libraries/cms/application/helper.php';
- require $joomlaBase . '/libraries/cms/application/cms.php';
- require $joomlaBase . '/libraries/cms/application/administrator.php';
+ require_once $joomlaBase . '/libraries/cms/application/helper.php';
+ require_once $joomlaBase . '/libraries/cms/application/cms.php';
+ require_once $joomlaBase . '/libraries/cms/application/administrator.php';
}
}
$loginURL = $config->userFrameworkBaseURL;
$loginURL = str_replace('administrator/', '', $loginURL);
$loginURL .= 'index.php?option=com_users&view=login';
+
+ //CRM-14872 append destination
+ if ( !empty($destination) ) {
+ $loginURL .= '&return='.urlencode(base64_encode($destination));
+ }
return $loginURL;
}
* @param $form
*/
public function getLoginDestination(&$form) {
- return;
+ $args = NULL;
+
+ $id = $form->get('id');
+ if ($id) {
+ $args .= "&id=$id";
+ }
+ else {
+ $gid = $form->get('gid');
+ if ($gid) {
+ $args .= "&gid=$gid";
+ }
+ else {
+ // Setup Personal Campaign Page link uses pageId
+ $pageId = $form->get('pageId');
+ if ($pageId) {
+ $component = $form->get('component');
+ $args .= "&pageId=$pageId&component=$component&action=add";
+ }
+ }
+ }
+
+ $destination = NULL;
+ if ($args) {
+ // append destination so user is returned to form they came from after login
+ $args = 'reset=1'.$args;
+ $destination = CRM_Utils_System::url(CRM_Utils_System::currentPath(), $args, TRUE, NULL, TRUE, TRUE);
+ }
+
+ return $destination;
}
/**
return TRUE;
}
}
+
+ /**
+ * output code from error function
+ * @param string $content
+ */
+ function outputError($content) {
+ if (class_exists('JErrorPage')) {
+ $error = new Exception($content);
+ JErrorPage::render($error);
+ }
+ else if (class_exists('JError')) {
+ JError::raiseError('CiviCRM-001', $content);
+ }
+ else {
+ parent::outputError($content);
+ }
+ }
}