public function onUserAfterSave($user, $isnew, $success, $msg) { if ($isnew) { // Initialise EasySocial's Foundry Framework // Include main file. jimport('joomla.filesystem.file'); $path = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php'; if (!JFile::exists($path)) { return false; } // Include the foundry engine require_once $path; $success = true; // Check if Foundry exists if (!Foundry::exists()) { Foundry::language()->loadSite(); echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING'); return; } if (!$success) { return false; } // Things that need to do here // 1. Insert user record into #__social_users // 2. Get the default profile // 3. Insert mapping into #__social_profiles_maps $userTable = Foundry::table('users'); $state = $userTable->load($user['id']); // If no user is found in #__social_users, then only we insert // If user is found, means the registration is coming from EasySocial itself. // The purpose here is to insert the user data if the registration is handled by other services if (!$state) { // Assign the user id $userTable->user_id = $user['id']; // Filter the username so that it becomes a valid alias $alias = JFilterOutput::stringURLSafe($user['username']); // Check if the alias exists. $userModel = Foundry::model('Users'); // Keep the original state of the alias $tmp = $alias; while ($userModel->aliasExists($alias, $user['id'])) { // Generate a new alias for the user. $alias = $tmp . '-' . rand(1, 150); } $userTable->alias = $alias; $userTable->state = $user['block'] === SOCIAL_JOOMLA_USER_BLOCKED ? SOCIAL_USER_STATE_PENDING : SOCIAL_USER_STATE_ENABLED; $userTable->type = 'joomla'; $userTable->store(); $profileModel = Foundry::model('Profiles'); $defaultProfile = $profileModel->getDefaultProfile(); if ($defaultProfile) { $defaultProfile->addUser($user['id']); } $controller = JRequest::getCmd('controller', ''); if ($controller != 'registration') { // if this user saving is coming from registration, then we dont add the user into finder. let the registration controller do the job. // Get the user object now $esUser = Foundry::user($user['id']); // Sync the index $esUser->syncIndex(); } } } return true; }
$input_lng = $jinput->get('lng', ''); $doc = JFactory::getDocument(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $lang = JFactory::getLanguage(); $lang->load('com_geommunity3es', JPATH_SITE, '', false); $file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php'; jimport('joomla.filesystem.file'); if (!JFile::exists($file)) { return; } require_once $file; // Include main Easysocial engine $modules = Foundry::modules('mod_easysocial_toolbar'); $modules->loadComponentScripts(); if (!Foundry::exists()) { echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING'); return; } $config = Foundry::config(); $naming = $config->get('users.displayName'); // username or realname if ($naming == 'realname') { $naming = 'name'; } if (JFactory::getApplication()->input->get('option') != 'com_easysocial') { $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/base.min.css'); $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/style.min.css'); $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/more.min.css'); } // component params