/** * Service for get username when they forgot username. * * @param string $email Email of user account * * @return boolean True on success. False otherwise. */ public function forgotUsername($email) { // Load language from com_users $language = JFactory::getLanguage(); $language->load('com_users'); // Load stuff from com_users jimport('joomla.application.component.model'); JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_users/models'); JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms'); JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields'); JLoader::import('route', JPATH_SITE . '/components/com_users/helpers'); $model = RModel::getFrontInstance('Remind', array('ignore_request' => true), 'com_users'); $data = array('email' => $email); // Submit the password reset request. $return = $model->processRemindRequest($data); return (bool) $return; }
/** * Load model class for data manipulation * * @param string $elementName Element name * @param SimpleXMLElement $configuration Configuration for current action * * @return mixed Model class for data manipulation * * @since 1.2 */ public function loadModel($elementName, $configuration) { $this->setOptionViewName($elementName, $configuration); $isAdmin = RApiHalHelper::isAttributeTrue($configuration, 'isAdminClass'); $this->addModelIncludePaths($isAdmin, $this->optionName); $this->loadExtensionLanguage($this->optionName, $isAdmin ? JPATH_ADMINISTRATOR : JPATH_SITE); $this->triggerFunction('loadExtensionLibrary', $this->optionName); $dataMode = strtolower(RApiHalHelper::attributeToString($configuration, 'dataMode', 'model')); if ($dataMode == 'helper') { return $this->getHelperObject(); } if ($dataMode == 'table') { return $this->getDynamicModelObject($configuration); } if (!empty($configuration['modelClassName'])) { $modelClass = (string) $configuration['modelClassName']; if (!empty($configuration['modelClassPath'])) { require_once JPATH_SITE . '/' . $configuration['modelClassPath']; if (class_exists($modelClass)) { return new $modelClass(); } } else { $componentName = ucfirst(strtolower(substr($this->optionName, 4))); $prefix = $componentName . 'Model'; $model = RModel::getInstance($modelClass, $prefix); if ($model) { return $model; } } } if (!empty($this->viewName)) { $elementName = $this->viewName; } if ($isAdmin) { return RModel::getAdminInstance($elementName, array(), $this->optionName); } return RModel::getFrontInstance($elementName, array(), $this->optionName); }