本文整理汇总了PHP中UserService::getUserByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP UserService::getUserByEmail方法的具体用法?PHP UserService::getUserByEmail怎么用?PHP UserService::getUserByEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService::getUserByEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUser
function addUser($reservationDetails, $reservationId)
{
$user = JFactory::getUser();
if (!$user->id || $user->guest == 1) {
$userObj = UserService::getUserByEmail($reservationDetails->reservationData->userData->email);
if (isset($userObj->id)) {
$userId = $userObj->id;
} else {
$userId = $this->addJoomlaUser($reservationDetails);
}
} else {
$userId = $user->id;
}
$this->setConfirmationUser($reservationId, $userId);
}
示例2: 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;
}