/** * Check if a user can administer the community */ public static function isCommunityAdmin($userid = null) { static $resultArr; if (isset($resultArr[$userid])) { return $resultArr[$userid]; } //for Joomla 1.6 afterward checking $jUser = CFactory::getUser($userid); if ($jUser instanceof CUser && method_exists($jUser, 'authorise')) { // group 6 = manager, 7 = administrator if ($jUser->authorise('core.admin') || $jUser->authorise('core.manage')) { $resultArr[$userid] = true; return true; } else { $resultArr[$userid] = false; return false; } } //for joomla 1.5 $my = CFactory::getUser($userid); $cacl = CACL::getInstance(); $usergroup = $cacl->getGroupsByUserId($my->id); $admingroups = array(0 => 'Super Administrator', 1 => 'Administrator', 2 => 'Manager', 3 => 'Super Users'); return in_array($usergroup, $admingroups); //return ( $my->usertype == 'Super Administrator' || $my->usertype == 'Administrator' || $my->usertype == 'Manager' ); }
/** * Check if a user can administer the community */ public static function isCommunityAdmin($userid = null) { $my = CFactory::getUser($userid); $cacl = CACL::getInstance(); $usergroup = $cacl->getGroupsByUserId($my->id); $admingroups = array(0 => 'Super Administrator', 1 => 'Administrator', 2 => 'Manager', 3 => 'Super Users'); return in_array($usergroup, $admingroups); //return ( $my->usertype == 'Super Administrator' || $my->usertype == 'Administrator' || $my->usertype == 'Manager' ); }
/** * Save user's joomla-user-type * @param $userid * @param $newUsertype * @return true/false */ function updateJoomlaUserType($userid, $newUsertype = JOOMLA_USER_TYPE_NONE) { //do not change usertypes for admins if (XiptHelperUtils::isAdmin($userid) == true || 0 == $userid || $newUsertype === JOOMLA_USER_TYPE_NONE) { return false; } //self::reloadCUser($userid); $user = CFactory::getUser($userid); $authorize = JFactory::getACL(); $user->set('usertype', $newUsertype); if (XIPT_JOOMLA_15) { $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO')); } else { $group = CACL::getInstance(); $groups[] = $group->getGroupID($newUsertype); JUserHelper::setUserGroups($userid, $groups); } $user->save(); self::reloadCUser($userid); return true; }
/** * Private method to create a user in the site. * */ private function _createUser($tmpUser, $requireApproval = false, $profileType = 0) { if (empty($tmpUser) || !isset($tmpUser->username)) { JError::raiseError(500, JText::_('COM_COMMUNITY_REGISTRATION_MISSING_USER_OBJ')); return; } //Remove whitespace infront of username $tmpUser->username = trim($tmpUser->username); $user = clone JFactory::getUser(); $authorize = JFactory::getACL(); $usersConfig = JComponentHelper::getParams('com_users'); $cacl = CACL::getInstance(); $userObj = get_object_vars($tmpUser); // Get usertype from configuration. If tempty, user 'Registered' as default $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the post array to the user object if (!$user->bind($userObj, 'usertype')) { JError::raiseError(500, $user->getError()); } // Initialize user default values $date = JFactory::getDate(); if ($requireApproval) { $user->set('block', 1); } $user->set('id', 0); $user->set('usertype', $newUsertype); $user->set('gid', $newUsertype); //set group for J1.6 $user->set('groups', array($newUsertype => $newUsertype)); $user->set('registerDate', $date->toSql()); // If user activation is turned on, we need to set the activation information. In joomla 1.6, still need to send activation link email when admin approval is enable $useractivation = $usersConfig->get('useractivation'); if ($useractivation != 0 && !$requireApproval) { jimport('joomla.user.helper'); $user->set('block', '1'); } //Jooomla 3.2.0 fix. TO be remove in future if (version_compare(JVERSION, '3.2.0', '=')) { $salt = JUserHelper::genRandomPassword(32); $crypt = JUserHelper::getCryptedPassword($userObj['password2'], $salt); $password = $crypt . ':' . $salt; } else { // Don't re-encrypt the password // JUser bind has encrypted the password $password = $userObj['password2']; } $user->set('password', $password); if ($useractivation != 0) { $user->set('activation', JApplication::getHash(JUserHelper::genRandomPassword())); } // If there was an error with registration, set the message and display the form if (!$user->save()) { JError::raiseWarning('', JText::_($user->getError())); $this->register(); return false; } if ($user->id == 0) { $uModel = $this->getModel('user'); $newUserId = $uModel->getUserId($user->username); $user = JFactory::getUser($newUserId); } // Update the user's invite if any // @todo: move this into plugin. onUserCreated $inviteId = JRequest::getVar('inviteId', 0, 'COOKIE'); $cuser = CFactory::getUser($user->id); if ($profileType != COMMUNITY_DEFAULT_PROFILE) { $multiprofile = JTable::getInstance('MultiProfile', 'CTable'); $multiprofile->load($profileType); // @rule: set users profile type. $cuser->_profile_id = $profileType; //$cuser->_avatar = $multiprofile->avatar; //$cuser->_thumb = $multiprofile->thumb; } // @rule: increment user points for registrations. $cuser->_points += 2; // increase default value set by admin (only apply to new registration) $config = CFactory::getConfig(); $default_points = $config->get('defaultpoint'); if (isset($default_points) && $default_points > 0) { $cuser->_points += $config->get('defaultpoint'); } $config = CFactory::getConfig(); $cuser->_invite = $inviteId; $cuser->save(); //create default albums for user $avatarAlbum = JTable::getInstance('Album', 'CTable'); $avatarAlbum->addAvatarAlbum($cuser->id, 'profile'); $coverAlbum = JTable::getInstance('Album', 'CTable'); $coverAlbum->addCoverAlbum('profile', $cuser->id); $defaultAlbum = JTable::getInstance('Album', 'CTable'); $defaultAlbum->addDefaultAlbum($cuser->id, 'profile'); return $user; }
/** * Private method to create a user in the site. **/ private function _createUser($tmpUser, $requireApproval = false, $profileType = 0) { //Remove whitespace infront of username $tmpUser->username = trim($tmpUser->username); $user = clone JFactory::getUser(); $config =& JFactory::getConfig(); $authorize =& JFactory::getACL(); $usersConfig =& JComponentHelper::getParams('com_users'); $cacl =& CACL::getInstance(); if (empty($tmpUser)) { JError::raiseError(500, JText::_('COM_COMMUNITY_REGISTRATION_MISSING_USER_OBJ')); return; } $userObj = get_object_vars($tmpUser); // Get usertype from configuration. If tempty, user 'Registered' as default $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the post array to the user object if (!$user->bind($userObj, 'usertype')) { JError::raiseError(500, $user->getError()); } // Initialize user default values $date =& JFactory::getDate(); if ($requireApproval) { $user->set('block', 1); } $user->set('id', 0); $user->set('usertype', $newUsertype); $user->set('gid', C_JOOMLA_15 ? $cacl->getGroupID($newUsertype) : $newUsertype); //$user->set('gid', $cacl->getGroupID($newUsertype)); //set group for J1.6 if (!C_JOOMLA_15) { $user->set('groups', array($newUsertype => $newUsertype)); } $user->set('registerDate', $date->toMySQL()); // If user activation is turned on, we need to set the activation information. In joomla 1.6, still need to send activation link email when admin approval is enable $useractivation = $usersConfig->get('useractivation'); if ($useractivation != 0 && (!C_JOOMLA_15 || !$requireApproval && C_JOOMLA_15)) { jimport('joomla.user.helper'); $user->set('activation', md5(JUserHelper::genRandomPassword())); $user->set('block', '1'); } // Don't re-encrypt the password // JUser bind has encrypted the password $user->set('password', $userObj['password2']); // If there was an error with registration, set the message and display the form if (!$user->save()) { JError::raiseWarning('', JText::_($user->getError())); $this->register(); return false; } /*$act = new stdClass(); $act->cmd = 'users.new'; $act->actor = $user->id; $act->target = 0; $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_NEW_USER','{actor}' , $user->name); $act->content = ''; $act->app = 'users'; $act->cid = $user->id; $params = new CParameter(''); $params->set('actor' , $user->name ); // Add activity logging CFactory::load ( 'libraries', 'activities' ); CActivityStream::add( $act, $params->toString() );*/ if ($user->id == 0) { $uModel =& $this->getModel('user'); $newUserId = $uModel->getUserId($user->username); $user =& JFactory::getUser($newUserId); } // Update the user's invite if any // @todo: move this into plugin. onUserCreated $inviteId = JRequest::getVar('inviteId', 0, 'COOKIE'); $cuser = CFactory::getUser($user->id); if ($profileType != COMMUNITY_DEFAULT_PROFILE) { $multiprofile =& JTable::getInstance('MultiProfile', 'CTable'); $multiprofile->load($profileType); // @rule: set users profile type. $cuser->_profile_id = $profileType; $cuser->_avatar = $multiprofile->avatar; $cuser->_thumb = $multiprofile->thumb; } // @rule: increment user points for registrations. $cuser->_points += 2; // increase default value set by admin (only apply to new registration) $config = CFactory::getConfig(); $default_points = $config->get('defaultpoint'); if (isset($default_points) && $default_points > 0) { $cuser->_points += $config->get('defaultpoint'); } $config = CFactory::getConfig(); $cuser->_invite = $inviteId; $cuser->save(); return $user; }
/** * Save controller that receives arguments via HTTP POST. **/ public function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $lang =& JFactory::getLanguage(); $lang->load('com_users'); $userId = JRequest::getVar('userid', '', 'POST'); $mainframe =& JFactory::getApplication(); $message = ''; $url = JRoute::_('index.php?option=com_community&view=users', false); $my =& JFactory::getUser(); $acl =& JFactory::getACL(); $cacl =& CACL::getInstance(); $mailFrom = $mainframe->getCfg('mailfrom'); $fromName = $mainframe->getCfg('fromname'); $siteName = $mainframe->getCfg('sitename'); if (empty($userId)) { $message = JText::_('COM_COMMUNITY_USERS_EMPTY_USER_ID'); $mainframe->redirect($url, $message); } // Create a new JUser object $user = new JUser($userId); $original_gid = $user->get('gid'); $post = JRequest::get('post'); $post['username'] = JRequest::getVar('username', '', 'post', 'username'); $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW); $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW); $notifyEmailSystem = JRequest::getVar('sendEmail', '', 'post', 'sendEmail'); if (!$user->bind($post)) { $message = JText::_('COM_COMMUNITY_USERS_SAVE_USER_INFORMATION_ERROR') . ' : ' . $user->getError(); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } //$objectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' ); //$groups = $acl->get_object_groups( $objectID, 'ARO' ); //$this_group = JString::strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); $this_group = $cacl->getGroupsByUserId($user->get('id')); if ($user->get('id') == $my->get('id') && $user->get('block') == 1) { $message = JText::_('COM_COMMUNITY_USERS_BLOCK_YOURSELF'); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } if ($this_group == 'super administrator' && $user->get('block') == 1) { $message = JText::_('COM_COMMUNITY_USERS_BLOCK_SUPER_ADMINISTRATOR'); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } if ($this_group == 'administrator' && $my->get('gid') == 24 && $user->get('block') == 1) { $message = JText::_('COM_COMMUNITY_USERS_WARNBLOCK'); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } if ($this_group == 'super administrator' && $my->get('gid') != 25) { $message = JText::_('COM_COMMUNITY_USERS_SUPER_ADMINISTRATOR_EDIT'); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } $isNew = $user->get('id') == 0; if (!$isNew) { if ($user->get('gid') != $original_gid && $original_gid == 25) { $query = 'SELECT COUNT( ' . $db->nameQuote('id') . ' )' . ' FROM ' . $db->nameQuote('#__users') . ' WHERE ' . $db->nameQuote('gid') . ' = ' . $db->Quote(25) . ' AND ' . $db->nameQuote('block') . ' = ' . $db->Quote(0); $db->setQuery($query); $count = $db->loadResult(); if ($count <= 1) { $message = JText::_('COM_COMMUNITY_USERS_WARN_ONLY_SUPER'); $url = JRoute::_('index.php?option=com_community&view=users&layout=edit&id=' . $userId, false); $mainframe->redirect($url, $message); exit; } } } //Joomla 1.6 patch to keep the group ID of user intact when saving if (property_exists($user, 'groups')) { foreach ($user->groups as $groupid => $groupname) { $user->groups[$groupid] = $groupid; } } if (!$user->save()) { $message = JText::_('COM_COMMUNITY_USERS_SAVE_USER_INFORMATION_ERROR') . ' : ' . $user->getError(); $mainframe->redirect($url, $message); exit; } $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); $userRow = array(); $userRow[] = $user; $appsLib->triggerEvent('onUserDetailsUpdate', $userRow); // @rule: Send out email if it is a new user. if ($isNew) { $adminEmail = $my->get('email'); $adminName = $my->get('name'); $subject = JText::_('COM_COMMUNITY_USERS_NEW_USER_MESSAGE_SUBJECT'); $message = sprintf(JText::_('COM_COMMUNITY_USERS_NEW_USER_MESSAGE'), $user->get('name'), $siteName, JURI::root(), $user->get('username'), $user->password_clear); if (!empty($mailfrom) && !empty($fromName)) { $adminName = $fromName; $adminEmail = $mailFrom; } JUtility::sendMail($adminEmail, $adminName, $user->get('email'), $subject, $message); } // If updating self, load the new user object into the session if ($user->get('id') == $my->get('id')) { jimport('joomla.version'); $version = new JVersion(); $joomla_ver = $version->getHelpVersion(); // Get the user group from the ACL if ($joomla_ver <= '0.15') { $grp = $acl->getAroGroup($user->get('id')); // Mark the user as logged in $user->set('guest', 0); $user->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) { $user->set('aid', 2); } // Set the usertype based on the ACL group name $user->set('usertype', $grp->name); } elseif ($joomla_ver >= '0.16') { $grp_name = $cacl->getGroupUser($user->get('id')); // Mark the user as logged in $user->set('guest', 0); $user->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group if ($cacl->is_group_child_of($grp_name, 'Registered') || $cacl->is_group_child_of($grp_name, 'Public Backend')) { $user->set('aid', 2); } // Set the usertype based on the ACL group name $user->set('usertype', $grp_name); } $session =& JFactory::getSession(); $session->set('user', $user); } // Process and save custom fields $user = CFactory::getUser($userId); $model =& $this->getModel('users'); $userModel = CFactory::getModel('profile'); $values = array(); $profile = $userModel->getEditableProfile($userId, $user->getProfileType()); CFactory::load('libraries', 'profile'); foreach ($profile['fields'] as $group => $fields) { foreach ($fields as $data) { // Get value from posted data and map it to the field. // Here we need to prepend the 'field' before the id because in the form, the 'field' is prepended to the id. $postData = JRequest::getVar('field' . $data['id'], '', 'POST'); $values[$data['id']] = CProfileLibrary::formatData($data['type'], $postData); // @rule: Validate custom profile if necessary if (!CProfileLibrary::validateField($data['id'], $data['type'], $values[$data['id']], $data['required'])) { // If there are errors on the form, display to the user. $message = JText::sprintf('The field "%1$s" contain improper values', $data['name']); $mainframe->redirect('index.php?option=com_community&view=users&layout=edit&id=' . $user->id, $message, 'error'); return; } } } // Update user's parameter DST $params =& $user->getParams(); $offset = $post['daylightsavingoffset']; $params->set('daylightsavingoffset', $offset); $params->set('notifyEmailSystem', $notifyEmailSystem); // Update user's point $points = JRequest::getVar('userpoint', '', 'REQUEST'); if (!empty($points)) { $user->_points = $points; $user->save(); } // Update user's status if ($user->getStatus() != $post['status']) { $user->setStatus($post['status']); } $user->save('params'); $valuesCode = array(); foreach ($values as $key => &$val) { $fieldCode = $userModel->getFieldCode($key); if ($fieldCode) { $valuesCode[$fieldCode] =& $val; } } // Trigger before onBeforeUserProfileUpdate $args = array(); $args[] = $userId; $args[] = $valuesCode; $saveSuccess = false; $result = $appsLib->triggerEvent('onBeforeProfileUpdate', $args); if (!$result || !in_array(false, $result)) { $saveSuccess = true; $userModel->saveProfile($userId, $values); } // Trigger before onAfterUserProfileUpdate $args = array(); $args[] = $userId; $args[] = $saveSuccess; $result = $appsLib->triggerEvent('onAfterProfileUpdate', $args); if (!$saveSuccess) { $message = JText::_('COM_COMMUNITY_USERS_PROFILE_NOT_UPDATED'); $mainframe->redirect($url, $message, 'error'); } $message = JText::_('COM_COMMUNITY_USERS_UPDATED_SUCCESSFULLY'); $mainframe->redirect($url, $message); }
public function ajaxCreateNewAccount($name, $username, $email, $profileType) { $filter = JFilterInput::getInstance(); $name = $filter->clean($name, 'string'); $username = $filter->clean($username, 'string'); $email = $filter->clean($email, 'string'); $profileType = $filter->clean($profileType, 'int'); $profileType = empty($profileType) ? COMMUNITY_DEFAULT_PROFILE : $profileType; CFactory::load('libraries', 'facebook'); jimport('joomla.user.helper'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectModel = CFactory::getModel('Connect'); $userModel = CFactory::getModel('User'); $connectTable =& JTable::getInstance('Connect', 'CTable'); $mainframe =& JFactory::getApplication(); $userId = $facebook->getUser(); $response = new JAXResponse(); $connectTable->load($userId); $fields = array('first_name', 'last_name', 'birthday_date', 'current_location', 'status', 'pic', 'sex', 'name', 'pic_square', 'profile_url', 'pic_big', 'current_location'); $userInfo = $facebook->getUserInfo($fields, $userId); $config = CFactory::getConfig(); // @rule: Ensure user doesn't really exists // BUT, even if it exist, if it is not linked to existing user, // it could be a login problem from previous attempt. // delete it and re-create user if ($connectTable->userid && !$userModel->exists($connectTable->userid)) { $connectTable->delete(); $connectTable->userid = null; } if (!$connectTable->userid) { //@rule: Test if username already exists $username = $this->_checkUserName($username); $usersConfig =& JComponentHelper::getParams('com_users'); $authorize =& JFactory::getACL(); $cacl =& CACL::getInstance(); // Grab the new user type so we can get the correct gid for the ACL $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } // Generate a joomla password format for the user. $password = JUserHelper::genRandomPassword(); $userData = array(); $userData['name'] = $name; $userData['username'] = $username; $userData['email'] = $email; $userData['password'] = $password; $userData['password2'] = $password; // Update user's login to the current user $my = clone JFactory::getUser(); $my->bind($userData); $my->set('id', 0); $my->set('usertype', ''); $date =& JFactory::getDate(); $my->set('registerDate', $date->toMySQL()); $my->set('gid', C_JOOMLA_15 ? $cacl->getGroupID($newUsertype) : $newUsertype); //set group for J1.6 if (!C_JOOMLA_15) { $my->set('groups', array($newUsertype => $newUsertype)); } ob_start(); if (!$my->save()) { ?> <div style="margin-bottom: 5px;"><?php echo JText::_('COM_COMMUNITY_ERROR_VALIDATING_FACEBOOK_ACCOUNT'); ?> </div> <div><strong><?php echo JText::sprintf('Error: %1$s', $my->getError()); ?> </strong></div> <div class="clear"></div> <?php $actions = '<input type="button" onclick="joms.connect.update();" value="' . JText::_('COM_COMMUNITY_BACK_BUTTON') . '" class="button" />'; $content = ob_get_contents(); @ob_end_clean(); $response->addScriptCall('joms.jQuery("#cwin_logo").html("' . $config->get('sitename') . '");'); $response->addScriptCall('cWindowAddContent', $content, $actions); return $response->sendResponse(); } $my = CFactory::getUser($my->id); /* Update Profile Type -start- * mimic behavior from normal Jomsocial Registration */ if ($profileType != COMMUNITY_DEFAULT_PROFILE) { $multiprofile =& JTable::getInstance('MultiProfile', 'CTable'); $multiprofile->load($profileType); // @rule: set users profile type. $my->_profile_id = $profileType; $my->_avatar = $multiprofile->avatar; $my->_thumb = $multiprofile->thumb; $requireApproval = $multiprofile->approvals; } // @rule: increment user points for registrations. $my->_points += 2; /* If Profile Type require approval, need to send approval email */ // if ($requireApproval) // { // jimport('joomla.user.helper'); // $my->set('activation', md5( JUserHelper::genRandomPassword()) ); // $my->set('block', '1'); // } // increase default value set by admin (only apply to new registration) $default_points = $config->get('defaultpoint'); if (isset($default_points) && $default_points > 0) { $my->_points += $config->get('defaultpoint'); } if (!$my->save()) { ?> <div style="margin-bottom: 5px;"><?php echo JText::_('COM_COMMUNITY_ERROR_VALIDATING_FACEBOOK_ACCOUNT'); ?> </div> <div><strong><?php echo JText::sprintf('Error: %1$s', $my->getError()); ?> </strong></div> <div class="clear"></div> <?php $actions = '<input type="button" onclick="joms.connect.update();" value="' . JText::_('COM_COMMUNITY_BACK_BUTTON') . '" class="button" />'; $content = ob_get_contents(); @ob_end_clean(); $response->addScriptCall('joms.jQuery("#cwin_logo").html("' . $config->get('sitename') . '");'); $response->addScriptCall('cWindowAddContent', $content, $actions); return $response->sendResponse(); } /* Update Profile Type -end- */ /* If Profile Type require approval, need to send approval email */ // if ($requireApproval) // { // // require_once (JPATH_COMPONENT.DS.'controllers'.DS.'register.php'); // $registerController = new CommunityRegisterController(); // $registerController->sendEmail('registration_complete', $my, null , $requireApproval ); // // $actions = '<input type="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_OK_BUTTON') . '" class="button" />'; // $response->addScriptCall('cWindowAddContent', 'Verification email has been sent to your account. Please follow the instructions to activate your account.', $actions); // return $response->sendResponse(); // } $registerModel = CFactory::getModel('Register'); $admins = $registerModel->getSuperAdministratorEmail(); $sitename = $mainframe->getCfg('sitename'); $mailfrom = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $siteURL = JURI::root(); $subject = JText::sprintf('COM_COMMUNITY_ACCOUNT_DETAILS_FOR', $name, $sitename); $subject = html_entity_decode($subject, ENT_QUOTES); //@rule: Send email notifications to site admin. foreach ($admins as $row) { if ($row->sendEmail) { $message = JText::sprintf(JText::_('COM_COMMUNITY_SEND_MSG_ADMIN'), $row->name, $sitename, $my->name, $my->email, $my->username); $message = html_entity_decode($message, ENT_QUOTES); // Catch all email error message. Otherwise, it would cause // fb connect to stall ob_start(); JUtility::sendMail($mailfrom, $fromname, $row->email, $subject, $message); ob_end_clean(); } } // Store user mapping so the next time it will be able to detect this facebook user. $connectTable->connectid = $userId; $connectTable->userid = $my->id; $connectTable->type = 'facebook'; $connectTable->store(); $response->addScriptCall('joms.connect.update();'); return $response->sendResponse(); } }