public function handle()
 {
     require_once PATH_CORE . DS . 'components' . DS . 'com_storefront' . DS . 'models' . DS . 'Memberships.php';
     $ms = new \Components\Storefront\Models\Memberships();
     /* NEW
     		$subscription = StorefrontModelMemberships::getSubscriptionObject($this->type, $this->pId, $this->uId);
     		// Get the expiration for the current subscription (if any)
     		$currentExpiration = $subscription->getExpiration();
     		*/
     // Get current registration
     $membership = $ms->getMembershipInfo($this->crtId, $this->item['info']->pId);
     $expiration = $membership['crtmExpires'];
     /* Add the user to the corresponding user access group (pull access group ID from the meta) */
     try {
         // Get user ID for the cart
         require_once dirname(dirname(dirname(__DIR__))) . DS . 'models' . DS . 'Cart.php';
         $userId = \Components\Cart\Models\Cart::getCartUser($this->crtId);
         // Get the user group ID to set the user to (from meta)
         require_once PATH_CORE . DS . 'components' . DS . 'com_storefront' . DS . 'models' . DS . 'Product.php';
         $userGId = \Components\Storefront\Models\Product::getMeta($this->item['info']->pId, 'userGroupId');
         $add = \JUserHelper::addUserToGroup($userId, $userGId);
         if ($add instanceof \Exception) {
             mail(Config::get('mailfrom'), 'Error adding to the group', $add->getMessage() . ' Cart #' . $this->crtId);
         }
         $table = \JTable::getInstance('User', 'JTable', array());
         $table->load($userId);
         // Trigger the onAftereStoreUser event
         Event::trigger('onUserAfterSave', array($table->getProperties(), false, true, null));
     } catch (Exception $e) {
         // Error
         return false;
     }
 }
コード例 #2
0
 function groupsSync(&$group, $memberid)
 {
     // Get sync mappings
     $mappings = self::getJomSocialGroupSyncMappings();
     if (empty($mappings)) {
         return;
     }
     // Instantiate JomSocial
     require_once JPATH_ROOT . '/administrator/components/com_community/defines.php';
     require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
     jimport('joomla.user.helper');
     $model = CFactory::getModel('Groups');
     foreach ($mappings as $mapping) {
         if ($model->isMember($memberid, $mapping['jsgroup_id']) && $mapping['jsgroup_id'] == $group->id) {
             // Add user to jgroup members table
             JUserHelper::addUserToGroup($memberid, $mapping['jgroup_id']);
         }
     }
     return true;
 }
コード例 #3
0
 /**
  * Testing addUserToGroup() with expected exception.
  *
  * @return  void
  *
  * @since   12.3
  * @expectedException  RuntimeException
  * @covers  JUserHelper::addUsertoGroup
  */
 public function testAddUserToGroupException()
 {
     JUserHelper::addUserToGroup(44, 99);
 }
コード例 #4
0
ファイル: controller.php プロジェクト: ratto/personallgroup
 function adicionaGrupoConteudista($id)
 {
     /*
      * Pedro "Ratto" Paixão, PersonallGroup, 2015
      * Função criada para adicionar o empresário nos grupos
      * Personall (permitindo acesso às páginas verdes), Conteudista
      * (permitindo acesso às páginas vermelhas) e Empresario
      *  (permitindo o acesso à administração de uma empresa.
      */
     jimport('joomla.user.helper');
     JUserHelper::addUserToGroup((int) $id, 11);
 }
コード例 #5
0
 public function onContentAfterSave($context, &$article, $isNew)
 {
     $ruleID = $article->id;
     $ruleState = $article->state;
     $jgroup_id = $article->jgroup_id;
     $jsgroup_id = $article->jsgroup_id;
     //if the sync rule is disabled, take no action and exit
     if (!$ruleState) {
         return true;
     }
     //if we are not in the right context, exit
     if (!in_array($context, array('com_jomsocialgroupsync.synchronizationrule', 'com_jomsocialgroupsync.synchronizationrules'))) {
         return true;
     }
     //include Joomla files
     jimport('joomla.user.helper');
     jimport('joomla.access.access');
     // Instantiate JomSocial
     require_once JPATH_ROOT . '/administrator/components/com_community/defines.php';
     require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
     //update Joomla groups
     $model = CFactory::getModel('Groups');
     $members = $model->getMembers($jsgroup_id);
     foreach ($members as $member) {
         //add to Joomla group
         JUserHelper::addUserToGroup($member->id, $jgroup_id);
     }
     // update JomSocial groups
     $group =& JTable::getInstance('Group', 'CTable');
     $data = new stdClass();
     $data->approved = 1;
     $data->permissions = 0;
     $data->groupid = $jsgroup_id;
     $jGroupUsers = JAccess::getUsersByGroup($jgroup_id);
     foreach ($jGroupUsers as $userid) {
         //add to JomSocial group
         $data->memberid = $userid;
         if (!$model->isMember($data->memberid, $data->groupid)) {
             $group->addMember($data);
         }
     }
     return true;
 }
コード例 #6
0
ファイル: helper.php プロジェクト: adjaika/J3Base
 /**
  * Helper wrapper method for addUserToGroup
  *
  * @param   integer  $userId   The id of the user.
  * @param   integer  $groupId  The id of the group.
  *
  * @return  boolean  True on success
  *
  * @see     JUserHelper::addUserToGroup()
  * @since   3.4
  * @throws  RuntimeException
  */
 public function addUserToGroup($userId, $groupId)
 {
     return JUserHelper::addUserToGroup($userId, $groupId);
 }
コード例 #7
0
ファイル: helper.php プロジェクト: q0821/esportshop
 public static function checkChangeLevel($referrerid, $newtotal)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ok = 0;
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables');
     $resultChangeLevel1 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel1', 0, $referrerid);
     $resultChangeLevel2 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel2', 0, $referrerid);
     $resultChangeLevel3 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel3', 0, $referrerid);
     if ($resultChangeLevel1) {
         $checkAlreadyDone1 = explode(',', $resultChangeLevel1[0]->exclude_items);
     }
     if ($resultChangeLevel2) {
         $checkAlreadyDone2 = explode(',', $resultChangeLevel2[0]->exclude_items);
     }
     if ($resultChangeLevel3) {
         $checkAlreadyDone3 = explode(',', $resultChangeLevel3[0]->exclude_items);
     }
     $userid = AlphaUserPointsHelper::getUserID($referrerid);
     // get actual group fot this user
     jimport('joomla.user.helper');
     $authorizedLevels = JAccess::getAuthorisedViewLevels($userid);
     $result = array_keys(JUserHelper::getUserGroups($userid));
     $actualgroup = end($result);
     if ($resultChangeLevel1 && $newtotal >= $resultChangeLevel1[0]->points2 && !in_array(intval($resultChangeLevel1[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone1)) {
         // delete old group
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel1[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel1;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         // insert done for this user in this rule
         if ($resultChangeLevel1[0]->exclude_items != '') {
             $insertUserId = $resultChangeLevel1[0]->exclude_items . ',' . $userid;
         } else {
             $insertUserId = $userid;
         }
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel1[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel2 && $newtotal >= $resultChangeLevel2[0]->points2 && !in_array(intval($resultChangeLevel2[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone2)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel2[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel2;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel2[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel3 && $newtotal >= $resultChangeLevel3[0]->points2 && !in_array(intval($resultChangeLevel3[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone3)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel3[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel3;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel3[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($ok) {
         // refresh session if user online
         $temp = JFactory::getUser((int) $userid);
         $temp->groups = $user->groups;
         $temp = JFactory::getUser((int) $userid);
         if ($temp->id == $userid) {
             $temp->groups = $user->groups;
         }
     }
     // show message only for current user and if frontend site
     if ($referrerid == @$_SESSION['referrerid'] && $app->isSite() && $ok) {
         // display message for the current user
         if ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg != '') {
             $msg = str_replace('{username}', $user->username, $resultChangeLevel[0]->msg);
             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points), $msg);
             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
             AlphaUserPointsHelper::displayMessageSystem($msg);
         } elseif ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg == '') {
             AlphaUserPointsHelper::displayMessageSystem(sprintf(JText::_('AUP_MSG_YOUHAVENEWUSERRIGHTS'), AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points2), $actualnamegroup));
         }
     }
     if ($ok) {
         // insert this new activity in database
         $datareference = sprintf(JText::_('AUP_DESCRIPTIONACTIVITYONCHANGELEVEL'), AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points2), $actualnamegroup);
         //AlphaUserPointsHelper::insertUserPoints( $referrerid, $resultChangeLevel[0], 0, '', $datareference );
         //Send notification
         if ($resultChangeLevel[0]->notification) {
             AlphaUserPointsHelper::sendnotification($referrerid, $resultChangeLevel[0]->points2, $newtotal, $resultChangeLevel[0]);
             // load external plugins
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('alphauserpoints');
             $rule_name = JText::_($resultChangeLevel[0]->rule_name);
             $results = $dispatcher->trigger('onSendNotificationAlphaUserPoints', array(&$resultChangeLevel[0], $rule_name, $resultChangeLevel[0]->points2, $newtotal, $referrerid, $userid));
         }
         // load external plugins
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('alphauserpoints');
         $results = $dispatcher->trigger('onChangeLevelAlphaUserPoints', array(&$resultChangeLevel[0], $actualnamegroup, $userid, $referrerid));
     }
 }
コード例 #8
0
ファイル: juser.php プロジェクト: juliano-hallac/fabrik
 /**
  * process the plugin, called when form is submitted
  *
  * @param object $params
  * @param object form
  */
 function onBeforeStore(&$params, &$formModel)
 {
     $app = JFactory::getApplication();
     //if the fabrik table is set to be jos_users and the this plugin is used
     //we need to alter the form model to tell it not to store the main row
     // but to still store any joined rows
     $ftable = str_replace('#__', $app->getCfg('dbprefix'), $formModel->getlistModel()->getTable()->db_table_name);
     $jos_users = $app->getCfg('dbprefix') . 'users';
     if ($ftable == $jos_users) {
         $formModel->_storeMainRow = false;
     }
     $usersConfig = JComponentHelper::getParams('com_users');
     // Initialize some variables
     $me = JFactory::getUser();
     $acl = JFactory::getACL();
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $SiteName = $app->getCfg('sitename');
     $siteURL = JURI::base();
     $bypassActivation = $params->get('juser_bypass_activation', false);
     $bypassRegistration = $params->get('juser_bypass_registration', true);
     $usertype_max = (int) $params->get('juser_usertype_max', 1);
     // load in the com_user language file
     $lang =& JFactory::getLanguage();
     $lang->load('com_user');
     $data =& $formModel->_formData;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $option = JRequest::getCmd('option');
     $original_id = 0;
     if ($params->get('juser_field_userid') != '') {
         $this->useridfield = $this->getFieldName($params, 'juser_field_userid');
         if (!empty($formModel->_rowId)) {
             $original_id = (int) $data[$this->useridfield];
         }
     } else {
         $original_id = 0;
         $this->useridfield = '';
     }
     // Create a new JUser object
     $user = new JUser($original_id);
     $original_gid = $user->get('gid');
     // Are we dealing with a new user which we need to create?
     $isNew = $user->get('id') < 1;
     //$post = JRequest::get('post');
     if ($isNew && $usersConfig->get('allowUserRegistration') == '0' && !$bypassRegistration) {
         JError::raiseError(403, JText::_('Access Forbidden - Registration not enabled'));
         return false;
     }
     //new
     $post = array();
     $this->passwordfield = $this->getFieldName($params, 'juser_field_password');
     $this->passwordvalue = $this->getFieldValue($params, 'juser_field_password', $data);
     $this->namefield = $this->getFieldName($params, 'juser_field_name');
     $this->namevalue = $this->getFieldValue($params, 'juser_field_name', $data);
     $this->usernamefield = $this->getFieldName($params, 'juser_field_username');
     $this->usernamevalue = $this->getFieldValue($params, 'juser_field_username', $data);
     $this->emailfield = $this->getFieldName($params, 'juser_field_email');
     $this->emailvalue = $this->getFieldValue($params, 'juser_field_email', $data);
     $post['id'] = $original_id;
     if (!$isNew) {
         // for now, don't allow changing f GIDthru JUser plugin!
         // $post['gid'] = $original_gid;
         // $$$ hugh - let's allow gid to be changed as long as it doesn't
         // exceed the currently logged on user's level
         // yes, i know this duplicates codce from below, for now I'm just noodling around
         if ($params->get('juser_field_usertype') != '') {
             $this->gidfield = $this->getFieldName($params, 'juser_field_usertype');
             $post['gid'] = JArrayHelper::getValue($data, $this->gidfield, 1);
             if (is_array($post['gid'])) {
                 $post['gid'] = $post['gid'][0];
             }
             $post['gid'] = (int) $post['gid'];
             if ($post['gid'] > $me->get('gid')) {
                 $post['gid'] = $me->get('gid');
             }
         } else {
             // if editing an existing user and no gid field being used,
             // use existing gid.
             $post['gid'] = $original_gid;
         }
     } else {
         if ($params->get('juser_field_usertype') != '') {
             $this->gidfield = $this->getFieldName($params, 'juser_field_usertype');
             $post['gid'] = JArrayHelper::getValue($data, $this->gidfield, 1);
             if (is_array($post['gid'])) {
                 $post['gid'] = $post['gid'][0];
             }
         } else {
             $post['gid'] = 1;
         }
     }
     $post['gid'] = (int) $post['gid'];
     if ($post['gid'] === 0) {
         $post['gid'] = 1;
     }
     // $$$ hugh - added 'usertype_max' param, as a safety net to prevent GID's being
     // set to arbitrarily high values thru spoofing.
     if ($post['gid'] > $usertype_max && $post['gid'] != $original_gid) {
         //$post['gid'] = $usertype_max;
         $msg = JText::_('Attempting to set usertype above allowed level!');
         $app->enqueueMessage($msg, 'message');
         return false;
     }
     if ($params->get('juser_field_block') != '') {
         $this->blockfield = $this->getFieldName($params, 'juser_field_block');
         $blocked = JArrayHelper::getValue($data, $this->blockfield, '');
         if (is_array($blocked)) {
             // probably a dropdown
             $post['block'] = (int) $blocked[0];
         } else {
             $post['block'] = (int) $blocked;
         }
     } else {
         $post['block'] = 0;
     }
     //$$$tom get password field to use in $origdata object if editing user and not changing password
     $origdata =& $formModel->_origData;
     $pwfield = $this->passwordfield;
     $post['username'] = $this->usernamevalue;
     $post['password'] = $this->passwordvalue;
     $post['password2'] = $this->passwordvalue;
     $post['name'] = $this->namevalue;
     $name = $this->namevalue;
     $post['email'] = $this->emailvalue;
     $ok = $this->check($post, $formModel, $params);
     if (!$ok) {
         // @TODO - add some error reporting
         return false;
     }
     // Set the registration timestamp
     if ($isNew) {
         $now = JFactory::getDate();
         $user->set('registerDate', $now->toMySQL());
     }
     if ($isNew) {
         // If user activation is turned on, we need to set the activation information
         $useractivation = $usersConfig->get('useractivation');
         if ($useractivation == '1' && !$bypassActivation) {
             jimport('joomla.user.helper');
             $user->set('activation', md5(JUserHelper::genRandomPassword()));
             $user->set('block', '1');
         }
     }
     // Check that username is not greater than 150 characters
     $username = $post['username'];
     if (strlen($username) > 150) {
         $username = substr($username, 0, 150);
         $user->set('username', $username);
     }
     // Check that password is not greater than 100 characters
     if (strlen($post['password']) > 100) {
         $post['password'] = substr($post['password'], 0, 100);
     }
     // end new
     if (!$user->bind($post)) {
         echo "error";
         echo "<pre>";
         print_r($user);
         exit;
         $app->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
         $app->enqueueMessage($user->getError(), 'error');
         return false;
     }
     /* think following is done in user->save();
     		//$objectID 	= $acl->get_object_id('users', $user->get('id'), 'ARO');
     		//$groups 	= $acl->get_object_groups($objectID, 'ARO');
     		//$this_group = strtolower($acl->get_group_name($groups[0], 'ARO'));
     
     		if (!$isNew) {
     
     
     			if ($user->get('id') == $me->get('id') && $user->get('block') == 1) {
     				$msg = JText::_('You cannot block Yourself!');
     				$app->enqueueMessage($msg, 'message');
     				return false;
     			}
     			else if (( $this_group == 'super administrator') && $user->get('block') == 1) {
     				$msg = JText::_('You cannot block a Super Administrator');
     				$app->enqueueMessage($msg, 'message');
     				return false;
     			}
     			else if (( $this_group == 'administrator') && ($me->get('gid') == 24) && $user->get('block') == 1 )
     			{
     				$msg = JText::_('WARNBLOCK');
     				$app->enqueueMessage($msg, 'message');
     				return false;
     			}
     			else if (( $this_group == 'super administrator') && ($me->get('gid') != 25 ) )
     			{
     				$msg = JText::_('You cannot edit a super administrator account');
     				$app->enqueueMessage($msg, 'message');
     				return false;
     			}
     
     
     			$iAmSuperAdmin	= $me->authorise('core.admin');
     			// if group has been changed and where original group was Speical
     			if ($user->get('gid') != $original_gid && $iAmSuperAdmin) {
     				$db = FabrikWorker::getDbo();
     				// count number of active super admins
     				$query = 'SELECT COUNT( id )'
     				. ' FROM #__users'
     				. ' WHERE gid = 25'
     				. ' AND block = 0'
     				;
     				$db->setQuery($query);
     				$count = $db->loadResult();
     
     				if ($count <= 1 ) {
     					// disallow change if only one Super Admin exists
     					$this->setRedirect('index.php?option=com_users', JText::_('WARN_ONLY_SUPER'));
     					return false;
     				}
     			}
     		}*/
     /*
      * Lets save the JUser object
      */
     if (!$user->save()) {
         echo "err!";
         echo "<pre>";
         print_r($user);
         exit;
         $app->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
         $app->enqueueMessage($user->getError(), 'error');
         return false;
     }
     //assign user to a group
     JUserHelper::addUserToGroup($user->get('id'), $post['gid']);
     $session =& JFactory::getSession();
     JRequest::setVar('newuserid', $user->id);
     JRequest::setVar('newuserid', $user->id, 'cookie');
     $session->set('newuserid', $user->id);
     JRequest::setVar('newuserid_element', $this->useridfield);
     JRequest::setVar('newuserid_element', $this->useridfield, 'cookie');
     $session->set('newuserid_element', $this->useridfield);
     /*
      * Time for the email magic so get ready to sprinkle the magic dust...
      */
     if ($isNew) {
         $adminEmail = $me->get('email');
         $adminName = $me->get('name');
         $subject = sprintf(JText::_('PLG_FABRIK_FORM_JUSER_ACCOUNT_DETAILS_FOR'), $name, $SiteName);
         $subject = html_entity_decode($subject, ENT_QUOTES);
         if ($useractivation == 1 && !$bypassActivation) {
             $message = sprintf(JText::_('PLG_FABRIK_FORM_JUSER_SEND_MSG_ACTIVATE'), $name, $SiteName, $siteURL . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $siteURL, $username, $user->password_clear);
         } else {
             if ($params->get('juser_bypass_accountdetails', 0) != 1) {
                 //$$$tom adding Bypass Joomla's "Account details for..." email
                 $message = sprintf(JText::_('PLG_FABRIK_FORM_JUSER_SEND_MSG'), $name, $SiteName, $siteURL);
             }
         }
         $message = html_entity_decode($message, ENT_QUOTES);
         if ($MailFrom != '' && $FromName != '') {
             $adminName = $FromName;
             $adminEmail = $MailFrom;
         }
         if ($message) {
             //$$$tom see comment above about bypassing Joomla's email
             JUtility::sendMail($adminEmail, $adminName, $user->get('email'), $subject, $message);
         }
     }
     echo "<pre>";
     print_r($user);
     // If updating self, load the new user object into the session
     if ($user->get('id') == $me->get('id')) {
         // Get an ACL object
         $acl =& JFactory::getACL();
         // Get the user group from the ACL
         $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);
         $session->set('user', $user);
     }
     if (!empty($this->useridfield)) {
         $formModel->updateFormData($this->useridfield, $user->get('id'), true);
     }
     if ($ftable == $jos_users) {
         $formModel->_rowId = $user->get('id');
     }
 }
コード例 #9
0
ファイル: socialconnect.php プロジェクト: juanferden/adoperp
 public function save($data)
 {
     $pk = !empty($data['user_id']) ? $data['user_id'] : 0;
     $user = JUser::getInstance($pk);
     $my = JFactory::getUser();
     $db = $this->getDbo();
     $params = JComponentHelper::getParams('com_bt_socialconnect');
     //load plugin assigment
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('btsocialconnect');
     if ($params->get('remove_user') && $user->id == 0) {
         $data['username'] = $data['email'];
     }
     //If "name" was removed
     if (!isset($data["name"])) {
         $data['name'] = $data['user_fields']['first_name'] . ' ' . $data['user_fields']['last_name'];
     }
     //Check groups of user when save
     if (!empty($data['groups'])) {
         $iAmSuperAdmin = $my->authorise('core.admin');
         if ($iAmSuperAdmin && $my->get('id') == $pk) {
             $stillSuperAdmin = false;
             $myNewGroups = $data['groups'];
             foreach ($myNewGroups as $group) {
                 $stillSuperAdmin = $stillSuperAdmin ? $stillSuperAdmin : JAccess::checkGroup($group, 'core.admin');
             }
             if (!$stillSuperAdmin) {
                 $this->setError(JText::_('COM_BT_SOCIALCONNECT_ERROR_CANNOT_DEMOTE_SELF'));
                 return false;
             }
         }
     }
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError($user->getError());
         return false;
     }
     //Get value user field
     $user_fields = $data['user_fields'];
     if ($user->save()) {
         // Add group for user from usergroup field
         $group = $this->getUserGroupField();
         if ($group) {
             // removed all group defined in usergroup field
             $newGroup = $data['user_fields'][$group->alias];
             if (in_array($newGroup, $group->default_values['group'])) {
                 $oldGroup = array_diff($group->default_values['group'], array($newGroup));
                 // add group which user has selected
                 JUserHelper::addUserToGroup($user->id, $newGroup);
                 foreach ($oldGroup as $gr) {
                     JUserHelper::removeUserFromGroup($user->id, $gr);
                 }
             }
         }
         $this->setState('socialconnect.id', $user->id);
         $this->prepareFolders($this->saveDir);
         $this->prepareFolders($this->images_path);
         $path_image_avartar = $this->images_path;
         $data['user_id'] = $user->id;
         $data['params'] = $user->params;
         $IdUserOld = self::GetUserids();
         $IdOld = self::findIdOld($data['user_id'], $IdUserOld);
         $Oldata = self::getOldata($user->id);
         //Upload image
         if (isset($_FILES["user_fields"]["tmp_name"]) && !empty($_FILES["user_fields"]["tmp_name"])) {
             $source = $_FILES["user_fields"]["tmp_name"];
             foreach ($source as $key => $imgSource) {
                 if (!empty($imgSource)) {
                     $info = getimagesize($imgSource);
                     $imageExt = str_replace('image/', '', $info['mime']);
                     $imageName = md5($data['user_id'] . strtotime("now")) . '_(' . $data['username'] . '_' . $key . ')_' . '.' . $imageExt;
                     if (!empty($imgSource)) {
                         if (JFile::copy($imgSource, $path_image_avartar . $imageName)) {
                             foreach ($Oldata as $img) {
                                 @unlink(JPATH_SITE . '/images/bt_socialconnect/avatar/' . $img->{$key});
                             }
                             $user_fields[$key] = $imageName;
                         } else {
                             return false;
                         }
                     }
                 }
             }
         }
         //Conver string to save
         $keys = array_keys($user_fields);
         $values = array_values($user_fields);
         $value = array();
         foreach ($values as $key => $field) {
             if (is_array($field)) {
                 $field = implode(',', $field);
             }
             if (empty($field)) {
                 $field = '';
             }
             $value[] = '\'' . $db->escape($field) . '\'';
         }
         // End
         //Check user is new or no
         if ($IdOld >= 0) {
             $data['updated_time'] = JFactory::getDate()->toSql();
             $update = '';
             foreach ($keys as $i => &$key) {
                 $key = $db->escape($key);
                 $update .= $key . '=' . $value[$i] . ($i < count($keys) - 1 ? ',' : '');
             }
             //Update Bt_users
             $query = 'UPDATE  #__bt_users SET ' . $update . ' WHERE  user_id =' . (int) $data['user_id'];
             $db->setQuery($query);
             $result = $db->query();
             //Update Bt_connection
             if (isset($data['enabled_publishing']) && is_array($data['enabled_publishing'])) {
                 foreach ($data['enabled_publishing'] as $key => $value) {
                     $query = 'UPDATE  #__bt_connections  SET  enabled_publishing =\'' . $value . '\',updated_time =\'' . $data['updated_time'] . '\' WHERE user_id =\'' . $data['user_id'] . '\' AND social_type =\'' . $key . '\'';
                     $db->setQuery($query);
                     $db->query();
                 }
             }
         } else {
             if (!empty($keys)) {
                 $key = ',' . implode(',', $keys);
             } else {
                 $key = '';
             }
             if (!empty($value)) {
                 $value = ',' . implode(',', $value);
             } else {
                 $value = '';
             }
             //INSERT INTO  #__bt_users(user_id,profile_link,birthday,avatar) values(1,'http://','')
             $query = 'INSERT INTO  #__bt_users(user_id' . $key . ') VALUES(\'' . $data['user_id'] . '\'' . $value . ')';
             $db->setQuery($query);
             $db->query();
             // Check user is social connect network or register nomal
             if (isset($data['socialId']) && $data['socialId'] != '') {
                 if (!self::checkSocialID($data['socialId'], $data['loginType'], $data['user_id'])) {
                     $data['created_time'] = JFactory::getDate()->toSql();
                     $data['updated_time'] = '';
                     $query = 'INSERT INTO  #__bt_connections VALUES(\'' . '' . '\',\'' . $data['user_id'] . '\',\'' . $data['socialId'] . '\', \'' . $data['loginType'] . '\',\'' . $data['access_token'] . '\',\'' . $data['params'] . '\',\'' . $data['enabled_publishing'] . '\', \'' . $data['created_time'] . '\', \'' . $data['updated_time'] . '\')';
                     $db->setQuery($query);
                     $db->query();
                     //Auto login if user is social network connect
                     self::loginSocial($data['email']);
                 }
             } else {
                 //Check config auto login when save
                 if ($params->get('userautologin', 1) == '1') {
                     $app = JFactory::getApplication();
                     if (!$app->isAdmin()) {
                         self::loginSocial($data['email']);
                     }
                 }
             }
         }
         $results = $dispatcher->trigger('onBtSocialconnectSave', array($data, ''));
         // update bt property if exists
         if (file_exists(JPATH_ADMINISTRATOR . '/components/com_bt_property/com_bt_property.php')) {
             $params = JComponentHelper::getParams('com_bt_property');
             if ($params->get('agent_agency')) {
                 if (isset($data['user_fields'][$params->get('agent_agency')])) {
                     $agency = $data['user_fields'][$params->get('agent_agency')];
                     $query = ' SELECT count(*) FROM #__bt_property_agents where agent_id =' . $user->id;
                     $agency = $db->escape($agency);
                     if ($agency) {
                         $db->setQuery($query);
                         if ($db->loadResult()) {
                             $query = 'UPDATE #__bt_property_agents set agency_id= ' . $agency . ' where agent_id =' . $user->id;
                         } else {
                             $query = 'INSERT INTO #__bt_property_agents(agency_id,agent_id,hits) VALUES(' . $agency . ',' . $user->id . ',0)';
                         }
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
         // end bt properties
         return true;
     } else {
         $this->setError($user->getError());
         return false;
     }
 }
コード例 #10
0
 public function processTransaction($data)
 {
     if (!$this->loginUser()) {
         throw new Exception("Cannot login admin");
     }
     $userObj = UserService::getUserByEmail($data->reservationData->userData->email);
     if (isset($userObj->id)) {
         JUserHelper::addUserToGroup($userObj->id, 8);
     } else {
         throw new Exception("Cannot find client account " . $data->reservationData->userData->email);
     }
     if (!$this->loginClient($data->reservationData->userData->email, $data->userData->password)) {
         throw new Exception("Cannot login");
     }
     //error_reporting(E_ALL);
     //ini_set('display_errors','On');
     // create reservation product
     $vmProduct = JModel::getInstance("Product", "VirtueMartModel");
     $product = array();
     $product['product_name'] = $data->reservationData->hotel->hotel_name . " Reservation(" . $data->confirmation_id . ") from " . $data->reservationData->userData->start_date . ' to ' . $data->reservationData->userData->end_date;
     $product['slug'] = "hotel_reservation";
     $product['notification_template'] = 1;
     $product['product_unit'] = 'KG';
     $product['product_available_date'] = date("Y-m-d");
     $product['mprices'] = array('product_price' => array($data->cost > 0 ? $data->cost : $data->total));
     $product['mprices']['basePrice'] = array(0);
     //$product['mprices']['product_currency']=array(191);
     $product['mprices']['product_tax_id'] = array(0);
     $product['mprices']['salesPrice'] = array('');
     $product['mprices']['price_quantity_start'] = array('');
     $product['mprices']['price_quantity_end'] = array('');
     $product['mprices']['product_override_price'] = array('');
     $product['mprices']['virtuemart_product_price_id'] = array('');
     $product['mprices']['product_override_price'] = array('');
     $product['mprices']['virtuemart_shoppergroup_id'] = array('');
     $product['mprices']['product_discount_id'] = array(0);
     $product['mprices']['product_price_publish_up'] = array('');
     $product['mprices']['product_price_publish_down'] = array('');
     $product['mprices']['override'] = array('');
     $vmProduct->store($product);
     //add product to cart
     $cart = VirtueMartCart::getCart();
     $_POST['virtuemart_product_id'] = $vmProduct->_id;
     JRequest::setVar('virtuemart_product_id', $vmProduct->_id);
     JRequest::setVar('quantity', array(1));
     $cart->add();
     //update Bill TO info virtuemart
     $lastName = $data->reservationData->userData->last_name;
     $name = $data->reservationData->userData->first_name . " " . $data->reservationData->userData->last_name;
     $db = JFactory::getDBO();
     $country = $data->reservationData->userData->country;
     $query = "select * from #__virtuemart_countries where lower(country_name) like lower('%{$country}%') limit 0,1";
     $db->setQuery($query);
     $countryData = $db->loadObject();
     $vmCountryId = 0;
     if (count($countryData) > 0) {
         $vmCountryId = $countryData->virtuemart_country_id;
     }
     $query = "insert into #__virtuemart_userinfos(`virtuemart_user_id`,`address_type`,`name`,`first_name`,`last_name`,`phone_1`,`address_1`,`city`,`virtuemart_country_id`,`zip`,`created_by`) values( '" . JFactory::getUser()->id . "','BT','" . $name . "','" . $data->reservationData->userData->first_name . "','" . $lastName . "','" . $data->reservationData->userData->phone . "', '" . $data->reservationData->userData->address . "','" . $data->reservationData->userData->city . "',{$vmCountryId} ,'" . $data->reservationData->userData->postal_code . "','" . $data->confirmation_id . "')";
     $db->setQuery($query);
     if (!$db->query()) {
         throw new Exception("Cannot update billing info");
     }
     JUserHelper::removeUserFromGroup(JFactory::getUser()->id, 8);
     $result = new stdClass();
     $result->transaction_id = 0;
     $result->amount = $data->cost > 0 ? $data->cost : $data->total;
     $result->payment_date = date("Y-m-d");
     $result->response_code = 0;
     $result->confirmation_id = $data->confirmation_id;
     $result->currency = $data->reservationData->hotel->hotel_currency;
     $result->processor_type = $this->type;
     $result->status = PAYMENT_REDIRECT;
     $result->payment_status = PAYMENT_STATUS_PENDING;
     return $result;
 }
コード例 #11
0
ファイル: rsmembership.php プロジェクト: JozefAB/qk
 public static function updateGid($user_id, $gid, $unblock = false, $action = 'add')
 {
     try {
         jimport('joomla.user.helper');
         $user_id = (int) $user_id;
         if (!is_array($gid)) {
             $gid = explode(',', $gid);
         }
         JArrayHelper::toInteger($gid);
         // old version
         if (RSMembershipHelper::getConfig('replace_gid')) {
             JUserHelper::setUserGroups($user_id, $gid);
         } else {
             foreach ($gid as $group) {
                 if ($action == 'add') {
                     self::syslog('gid', "Adding user({$user_id}) to group({$group})");
                     JUserHelper::addUserToGroup($user_id, $group);
                 } elseif ($action == 'remove') {
                     self::syslog('gid', "Removing user({$user_id}) from group({$group})");
                     JUserHelper::removeUserFromGroup($user_id, $group);
                 }
             }
         }
         if ($unblock) {
             RSMembership::enableUser($user_id);
         }
     } catch (Exception $e) {
         self::syslog('gid', "Error on changing group for user({$user_id}). Message: " . $e->getMessage());
     }
 }
コード例 #12
0
ファイル: juser.php プロジェクト: Jobar87/fabrik
	/**
	 * process the plugin, called when form is submitted
	 *
	 * @param object $params
	 * @param object form
	 */

	function onBeforeStore(&$params, &$formModel)
	{
		$app = JFactory::getApplication();
		$config = JFactory::getConfig();
		$lang = JFactory::getLanguage();
		//load up com_users lang - used in email text
		$lang->load('com_users');

		//if the fabrik table is set to be jos_users and the this plugin is used
		//we need to alter the form model to tell it not to store the main row
		// but to still store any joined rows

		$ftable = str_replace('#__', $app->getCfg('dbprefix'), $formModel->getlistModel()->getTable()->db_table_name);
		$jos_users = $app->getCfg('dbprefix') . 'users';

		if ($ftable == $jos_users) {
			$formModel->_storeMainRow = false;
		}

		$usersConfig = JComponentHelper::getParams('com_users');
		// Initialize some variables
		$me = JFactory::getUser();
		$acl = JFactory::getACL();
		$MailFrom	= $app->getCfg('mailfrom');
		$FromName	= $app->getCfg('fromname');
		$SiteName	= $app->getCfg('sitename');
		$siteURL = JURI::base();
		$bypassActivation	= $params->get('juser_bypass_activation', false);
		$bypassRegistration	= $params->get('juser_bypass_registration', true);

		// load in the com_user language file
		$lang = JFactory::getLanguage();
		$lang->load('com_user');

		$data = $formModel->_formData;

		// Check for request forgeries
		JRequest::checkToken() or jexit('Invalid Token');

		$option = JRequest::getCmd('option');

		$original_id = 0;
		if ($params->get('juser_field_userid') != '') {
			$this->useridfield = $this->getFieldName($params, 'juser_field_userid');
			if (!empty($formModel->_rowId)) {
				$original_id = (int)$formModel->_formData[$this->useridfield];
			}
		}
		else {
			$original_id = 0;
			$this->useridfield = '';
		}

		// Create a new JUser object
		$user = new JUser($original_id);
		$originalGroups = $user->getAuthorisedGroups();

		// Are we dealing with a new user which we need to create?
		$isNew 	= ($user->get('id') < 1);

		if ($isNew && $usersConfig->get('allowUserRegistration') == '0' && !$bypassRegistration) {
			JError::raiseError(403, JText::_('Access Forbidden - Registration not enabled'));
			return false;
		}
		//new
		$data = array();

		$this->passwordfield 	= $this->getFieldName($params, 'juser_field_password');
		$this->passwordvalue  = $this->getFieldValue($params, 'juser_field_password', $formModel->_formData);

		$this->namefield 			= $this->getFieldName($params, 'juser_field_name');
		$this->namevalue  		= $this->getFieldValue($params, 'juser_field_name', $formModel->_formData);

		$this->usernamefield 	= $this->getFieldName($params, 'juser_field_username');
		$this->usernamevalue  = $this->getFieldValue($params, 'juser_field_username', $formModel->_formData);

		$this->emailfield 		= $this->getFieldName($params, 'juser_field_email');
		$this->emailvalue  		= $this->getFieldValue($params, 'juser_field_email', $formModel->_formData);

		$data['id'] = $original_id;

		$this->gidfield = $this->getFieldName($params, 'juser_field_usertype');
		$defaultGroup = (int)$params->get('juser_field_default_group');
		if (!$isNew) {
			if ($params->get('juser_field_usertype') != '') {
				
				$data['gid'] = JArrayHelper::getValue($formModel->_formData, $this->gidfield, $defaultGroup);
				if (is_array($data['gid'])) {
					$data['gid'] = $data['gid'][0];
				}
				$data['gid'] = (int)$data['gid'];
				if (!in_arary($data['gid'], $me->getAuthorisedGroups())) {
					$data['gid'] = array_pop($me->getAuthorisedGroups());
				}
			}
			else {
				// if editing an existing user and no gid field being used,
				// use default group id
				$data['gid'] = $defaultGroup;
			}
		}
		else {
			if ($params->get('juser_field_usertype') != '') {
				$data['gid'] = JArrayHelper::getValue($formModel->_formData, $this->gidfield, $defaultGroup);
				if (is_array($data['gid'])) {
					$data['gid'] = $data['gid'][0];
				}
			}
			else {
				$data['gid'] = $defaultGroup;
			}
		}
		$data['gid'] = (int)$data['gid'];
		if ($data['gid'] === 0) {
			$data['gid'] = $defaultGroup;
		}
		
		if ($params->get('juser_field_block') != '') {
			$this->blockfield = $this->getFieldName($params, 'juser_field_block');
			$blocked = JArrayHelper::getValue($formModel->_formData, $this->blockfield, '');
			if (is_array($blocked)) {
				// probably a dropdown
				$data['block'] = (int)$blocked[0];
			}
			else {
				$data['block'] = (int)$blocked;
			}
		}
		else {
			$data['block'] = 0;
		}

		//$$$tom get password field to use in $origdata object if editing user and not changing password
		$origdata = $formModel->_origData;
		$pwfield = $this->passwordfield;

		$data['username']	= $this->usernamevalue;
		$data['password']	= $this->passwordvalue;
		$data['password2']	= $this->passwordvalue;
		$data['name'] = $this->namevalue;
		$name = $this->namevalue;
		$data['email'] = $this->emailvalue;

		$ok = $this->check($data, $formModel, $params);
		if (!$ok) {
			// @TODO - add some error reporting
			return false;
		}
		// Set the registration timestamp

		if ($isNew) {
			$now = JFactory::getDate();
			$user->set('registerDate', $now->toMySQL());
		}

		if ($isNew) {
			// If user activation is turned on, we need to set the activation information
			$useractivation = $usersConfig->get('useractivation');
			if ($useractivation == '1' && !$bypassActivation)
			{
				jimport('joomla.user.helper');
				$data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
				$data['block'] = 1;
			}
		}

		// Check that username is not greater than 150 characters
		$username = $data['username'];
		if (strlen($username) > 150) {
			$username = substr($username, 0, 150);
			$user->set('username', $username);
		}

		// Check that password is not greater than 100 characters
		if (strlen($data['password']) > 100) {
			$data['password'] = substr($data['password'], 0, 100);
		}

		// end new
		if (!$user->bind($data))
		{
			$app->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
			$app->enqueueMessage($user->getError(), 'error');
			return false;
		}

		/*
		 * Lets save the JUser object
		 */
		if (!$user->save())
		{
			$app->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
			$app->enqueueMessage($user->getError(), 'error');
			return false;
		}
		//assign user to a group
		JUserHelper::addUserToGroup($user->get('id'), $data['gid']);
		$session = &JFactory::getSession();
		JRequest::setVar('newuserid', $user->id);
		JRequest::setVar('newuserid', $user->id, 'cookie');
		$session->set('newuserid', $user->id);
		JRequest::setVar('newuserid_element', $this->useridfield);
		JRequest::setVar('newuserid_element', $this->useridfield, 'cookie');
		$session->set('newuserid_element', $this->useridfield);
		/*
		 * Time for the email magic so get ready to sprinkle the magic dust...
		 */

		if ($isNew)
		{
			
			// Compile the notification mail values.
			$data = $user->getProperties();
			$data['fromname']	= $config->get('fromname');
			$data['mailfrom']	= $config->get('mailfrom');
			$data['sitename']	= $config->get('sitename');
			$data['siteurl']	= JUri::base();
			
			$uri = JURI::getInstance();
			$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
			
			// Handle account activation/confirmation emails.
			if ($useractivation == 2 && !$bypassActivation)
			{
				// Set the link to confirm the user email.
				$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
			
				$emailSubject	= JText::sprintf(
							'COM_USERS_EMAIL_ACCOUNT_DETAILS',
				$data['name'],
				$data['sitename']
				);
			
				$emailBody = JText::sprintf(
							'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY',
				$data['name'],
				$data['sitename'],
				$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],
				$data['siteurl'],
				$data['username'],
				$data['password_clear']
				);
			}
			else if ($useractivation == 1 && !$bypassActivation)
			{
				// Set the link to activate the user account.
				$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
			
				$emailSubject	= JText::sprintf(
							'COM_USERS_EMAIL_ACCOUNT_DETAILS',
				$data['name'],
				$data['sitename']
				);
			
				$emailBody = JText::sprintf(
							'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
				$data['name'],
				$data['sitename'],
				$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],
				$data['siteurl'],
				$data['username'],
				$data['password_clear']
				);
			} else {
			
				$emailSubject	= JText::sprintf(
							'COM_USERS_EMAIL_ACCOUNT_DETAILS',
				$data['name'],
				$data['sitename']
				);
			
				$emailBody = JText::sprintf(
							'COM_USERS_EMAIL_REGISTERED_BODY',
				$data['name'],
				$data['sitename'],
				$data['siteurl']
				);
			}

			// Send the registration email.
			$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
			
			// Check for an error.
			if ($return !== true) {
				$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
			
				// Send a system message to administrators receiving system mails
				$db = JFactory::getDBO();
				$q = "SELECT id
							FROM #__users
							WHERE block = 0
							AND sendEmail = 1";
				$db->setQuery($q);
				$sendEmail = $db->loadResultArray();
				if (count($sendEmail) > 0) {
					$jdate = new JDate();
					// Build the query to add the messages
					$q = "INSERT INTO `#__messages` (`user_id_from`, `user_id_to`, `date_time`, `subject`, `message`)
								VALUES ";
					$messages = array();
					foreach ($sendEmail as $userid) {
						$messages[] = "(".$userid.", ".$userid.", '".$jdate->toMySQL()."', '".JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')."', '".JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username'])."')";
					}
					$q .= implode(',', $messages);
					$db->setQuery($q);
					$db->query();
				}
				return false;
			}
			
		} 

		// If updating self, load the new user object into the session
		// FIXME - doesnt work in J1.7??
		/* if ($user->get('id') == $me->get('id'))
		{
			// Get an ACL object
			$acl = &JFactory::getACL();

			// Get the user group from the ACL
			$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);
			$session->set('user', $user);
		} */
		if (!empty($this->useridfield)) {
			$formModel->updateFormData($this->useridfield, $user->get('id'), true);
		}
		if ($ftable == $jos_users) {
			$formModel->_rowId = $user->get('id');
		}
	}