当前位置: 首页>>代码示例>>PHP>>正文


PHP JUserHelper::addUserToGroup方法代码示例

本文整理汇总了PHP中JUserHelper::addUserToGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP JUserHelper::addUserToGroup方法的具体用法?PHP JUserHelper::addUserToGroup怎么用?PHP JUserHelper::addUserToGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUserHelper的用法示例。


在下文中一共展示了JUserHelper::addUserToGroup方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 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;
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:Access_Group_Membership_Type_Handler.php

示例2: groupsSync

 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;
 }
开发者ID:kishoreweblabs,项目名称:JomSocial-Group-Sync,代码行数:20,代码来源:jomsocialgroupsync.php

示例3: testAddUserToGroupException

 /**
  * Testing addUserToGroup() with expected exception.
  *
  * @return  void
  *
  * @since   12.3
  * @expectedException  RuntimeException
  * @covers  JUserHelper::addUsertoGroup
  */
 public function testAddUserToGroupException()
 {
     JUserHelper::addUserToGroup(44, 99);
 }
开发者ID:sural98,项目名称:joomla-cms,代码行数:13,代码来源:JUserHelperTest.php

示例4: adicionaGrupoConteudista

 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);
 }
开发者ID:ratto,项目名称:personallgroup,代码行数:12,代码来源:controller.php

示例5: onContentAfterSave

 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;
 }
开发者ID:kishoreweblabs,项目名称:JomSocial-Group-Sync,代码行数:43,代码来源:jomsocialgroupsyncsystem.php

示例6: addUserToGroup

 /**
  * 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);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:16,代码来源:helper.php

示例7: checkChangeLevel

 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) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:helper.php

示例8: onBeforeStore


//.........这里部分代码省略.........
     			{
     				$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');
     }
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:101,代码来源:juser.php

示例9: save

 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) {
//.........这里部分代码省略.........
开发者ID:juanferden,项目名称:adoperp,代码行数:101,代码来源:socialconnect.php

示例10: processTransaction

 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;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:76,代码来源:virtuemart.php

示例11: updateGid

 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());
     }
 }
开发者ID:JozefAB,项目名称:qk,代码行数:30,代码来源:rsmembership.php

示例12: onBeforeStore


//.........这里部分代码省略.........
			}
		}

		// 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',
开发者ID:Jobar87,项目名称:fabrik,代码行数:67,代码来源:juser.php


注:本文中的JUserHelper::addUserToGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。