當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Group::Members方法代碼示例

本文整理匯總了PHP中Group::Members方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::Members方法的具體用法?PHP Group::Members怎麽用?PHP Group::Members使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Group的用法示例。


在下文中一共展示了Group::Members方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doRegister

 function doRegister($data, $form)
 {
     // Check for existing member emial address
     if ($member = DataObject::get_one("Member", "'Email' = '" . Convert::raw2sql($data['Email']) . "'")) {
         // Set error message
         $form->AddErrorMessage('Email', "Sorry, that email address already exists. Please choose another.", 'bad');
         // Set form data from submitted values
         Session::set("FormInfo.Form_RegistrationForm.data", $data);
         // Return back to form
         return Director::redirectBack();
     }
     // Otherwise create new member and log them in
     $Member = new Member();
     $form->saveInto($Member);
     $Member->write();
     $Member->login();
     // Find or create the 'user' group
     if (!($userGroup = DataObject::get_one('Group', "Code = 'users'"))) {
         $userGroup = new Group();
         $userGroup->Code = "users";
         $userGroup->Title = "Users";
         $userGroup->Write();
         $userGroup->Members()->add($Member);
     }
     // Add member to user group
     $userGroup->Members()->add($Member);
     // Get Profile page
     if ($ProfilePage = DataObject::get_one('EditProfilePage')) {
         return Director::redirect($ProfilePage->Link('?success=1'));
     }
 }
開發者ID:dunatron,項目名稱:onbaord-revamp,代碼行數:31,代碼來源:RegistrationPage.php

示例2: Register

 /**
  * @param $data
  * @param $form
  * @return bool|SS_HTTPResponse
  */
 function Register($data, $form)
 {
     // Set session array individually as setting the password breaks the form.
     $sessionArray = array('Email' => $data['Email']);
     // Check for existing member email address
     if ($existingUser = DataObject::get_one('Member', "Email = '" . Convert::raw2sql($data['Email']) . "'")) {
         $form->AddErrorMessage('Email', _t('RegistrationPage.EmailValidationText', 'Sorry, that email address already exists. Please choose another.'), 'validation');
         Session::set('FormInfo.Form_RegistrationForm.data', $sessionArray);
         return $this->redirectBack();
     }
     // Otherwise create new member and log them in
     $Member = new Member();
     $form->saveInto($Member);
     $Member->write();
     $Member->login();
     // Find or create the 'user' group
     if (!($userGroup = DataObject::get_one('Group', "Code = 'users'"))) {
         $userGroup = new Group();
         $userGroup->Code = 'users';
         $userGroup->Title = 'Users';
         $userGroup->Write();
         $userGroup->Members()->add($Member);
     }
     // Add member to user group
     $userGroup->Members()->add($Member);
     // Get profile page otherwise display warning.
     if ($ProfilePage = DataObject::get_one('EditProfilePage')) {
         $name = $data['FirstName'] ?: ($name = $data['Email']);
         $this->setFlash(_t('RegistrationPage.RegisteredSuccessText', 'Welcome ' . $name . ', your account has been created!'), 'success');
         return $this->redirect($ProfilePage->Link());
     } else {
         $this->setFlash(_t('RegistrationPage.RegisteredWarningText', 'Please add a "Edit Profile Page" in your SiteTree to enable profile editing'), 'warning');
         return $this->redirect(Director::absoluteBaseURL());
     }
 }
開發者ID:ormandroid,項目名稱:ss_boilerplate,代碼行數:40,代碼來源:RegistrationPage.php

示例3: doRegister

 function doRegister($data, Form $form)
 {
     //Check for existing member email address
     if ($member = DataObject::get_one("Member", "`Email` = '" . Convert::raw2sql($data['Email']) . "'")) {
         //Set error message
         $form->sessionMessage($data['Email'] . ". Sorry, that email address already exists. Please choose another.", 'bad');
         //Return back to form
         return $this->redirectBack();
         //return Director::redirectBack();
     } else {
         //Otherwise create new member and log them in
         $Member = new Member();
         $form->saveInto($Member);
         $Member->write();
         $Member->login();
         //Find or create the 'user' group
         if (!($userGroup = DataObject::get_one('Group', "Code = 'users'"))) {
             $userGroup = new Group();
             $userGroup->Code = "users";
             $userGroup->Title = "users";
             $userGroup->Write();
             $userGroup->Members()->add($Member);
         }
         //Add member to user group
         $userGroup->Members()->add($Member);
         //Get profile page
         if ($ProfilePage = DataObject::get_one('EditProfilePage')) {
             //echo "profile page exists";
             //Redirect to profile page with success message
             return $this->redirect($ProfilePage->Link());
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:phuongle-silverstripe-member-registration,代碼行數:33,代碼來源:RegistrationPage.php

示例4: testUnsavedGroups

 public function testUnsavedGroups()
 {
     $member = $this->objFromFixture('GroupTest_Member', 'admin');
     $group = new Group();
     // Can save user to unsaved group
     $group->Members()->add($member);
     $this->assertEquals(array($member->ID), array_values($group->Members()->getIDList()));
     // Persists after writing to DB
     $group->write();
     $group = Group::get()->byID($group->ID);
     $this->assertEquals(array($member->ID), array_values($group->Members()->getIDList()));
 }
開發者ID:XDdesigners,項目名稱:silverstripe-framework,代碼行數:12,代碼來源:GroupTest.php

示例5: Group

 static function add_members_to_customer_group()
 {
     $gp = DataObject::get_one("Group", "\"Title\" = '" . self::get_group_name() . "'");
     if (!$gp) {
         $gp = new Group();
         $gp->Title = self::get_group_name();
         $gp->Sort = 999998;
         $gp->write();
     }
     $allCombos = DB::query("Select \"ID\", \"MemberID\", \"GroupID\" FROM \"Group_Members\" WHERE \"Group_Members\".\"GroupID\" = " . $gp->ID . ";");
     //make an array of all combos
     $alreadyAdded = array();
     $alreadyAdded[-1] = -1;
     if ($allCombos) {
         foreach ($allCombos as $combo) {
             $alreadyAdded[$combo["MemberID"]] = $combo["MemberID"];
         }
     }
     $extraWhere = $unlistedMembers = DataObject::get("Member", $where = "\"Member\".\"ID\" NOT IN (" . implode(",", $alreadyAdded) . ")", $sort = null, $join = "INNER JOIN \"Order\" ON \"Order\".\"MemberID\" = \"Member\".\"ID\"");
     //add combos
     if ($unlistedMembers) {
         $existingMembers = $gp->Members();
         foreach ($unlistedMembers as $member) {
             $existingMembers->add($member);
         }
     }
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:27,代碼來源:HourlyEcommerceGroupUpdate.php

示例6: doUp

 function doUp()
 {
     global $database;
     $members = array(1368, 270, 9202);
     // EdgarMagana, JonProulx, ShillaSaebi
     $group = new Group();
     $group->setTitle('User Committee');
     $group->setDescription('User Committee');
     $group->setSlug('user-committee');
     $group->write();
     $group->Members()->setByIDList($members);
 }
開發者ID:OpenStackweb,項目名稱:openstack-org,代碼行數:12,代碼來源:CreateUserCommitteeGroupMigration.php

示例7: DoRegister

 public function DoRegister($data, $form)
 {
     if ($member = DataObject::get_one("Member", "`Email` = '" . Convert::raw2sql($data['Email']) . "'")) {
         $form->AddErrorMessage('Email', _t("REGISTRATION.EMAILEXISTS", "Sorry, that email address already exists. Please choose another."), 'bad');
         Session::set("FormInfo.Form_RegistrationForm.data", $data);
         return $this->redirectBack();
     }
     $Member = new Member();
     $form->saveInto($Member);
     $Member->write();
     $Member->logIn();
     if (!($userGroup = DataObject::get_one('Group', "Code = 'register-user'"))) {
         $userGroup = new Group();
         $userGroup->Code = "register-user";
         $userGroup->Title = "Register-user";
         $userGroup->write();
     }
     $userGroup->Members()->add($Member);
     return $this->redirect(Director::baseURL());
 }
開發者ID:8secs,項目名稱:cocina,代碼行數:20,代碼來源:RegistrationPage.php

示例8: logInWithPermission

 /**
  * Create a member and group with the given permission code, and log in with it.
  * Returns the member ID.
  */
 function logInWithPermission($permCode = "ADMIN")
 {
     if (!isset($this->cache_generatedMembers[$permCode])) {
         $group = new Group();
         $group->Title = "{$permCode} group";
         $group->write();
         $permission = new Permission();
         $permission->Code = $permCode;
         $permission->write();
         $group->Permissions()->add($permission);
         $member = DataObject::get_one('Member', sprintf('"Email" = \'%s\'', "{$permCode}@example.org"));
         if (!$member) {
             $member = new Member();
         }
         $member->FirstName = $permCode;
         $member->Surname = "User";
         $member->Email = "{$permCode}@example.org";
         $member->write();
         $group->Members()->add($member);
         $this->cache_generatedMembers[$permCode] = $member;
     }
     $this->cache_generatedMembers[$permCode]->logIn();
 }
開發者ID:hamishcampbell,項目名稱:silverstripe-sapphire,代碼行數:27,代碼來源:SapphireTest.php

示例9: doPrepaidSignup

 function doPrepaidSignup()
 {
     $data = $_POST;
     //Check for existing member email address
     if ($member = DataObject::get_one("Member", "`Email` = '" . Convert::raw2sql($data['Email']) . "'")) {
         return "inlineMsg1";
     }
     $currentYear = date('Y');
     $currentMonth = date('n');
     //Stop sign-up when the credit card is expired
     if ($data['ExpirationYear'] < $currentYear) {
         return "inlineMsg6";
     }
     if ($data['ExpirationYear'] == $currentYear) {
         if ($data['ExpirationMonth'] < $currentMonth) {
             return "inlineMsg6";
         }
     }
     //Get InfusionSoft Api
     $app = $this->getInfusionSoftApi();
     // Get country text from code
     $country = Geoip::countryCode2name($data['Country']);
     // Create IndusionSoft contact
     $returnFields = array('Id');
     $conInfo = $app->findByEmail($data['Email'], $returnFields);
     if (count($conInfo)) {
         $isConID = $conInfo[0]['Id'];
     } else {
         $conDat = array('FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'Company' => $data['Company'], 'StreetAddress1' => $data['StreetAddress1'], 'StreetAddress2' => $data['StreetAddress2'], 'City' => $data['City'], 'State' => $data['State'], 'PostalCode' => $data['PostalCode'], 'Country' => $country, 'Email' => $data['Email']);
         $isConID = $app->addCon($conDat);
     }
     // Locate existing credit card
     $ccID = $app->locateCard($isConID, substr($data['CreditCardNumber'], -4, 4));
     $creditCardType = $this->getISCreditCardType($data['CreditCardType']);
     if (!$ccID) {
         //Validate the credit card
         $card = array('CardType' => $creditCardType, 'ContactId' => $isConID, 'CardNumber' => $data['CreditCardNumber'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear'], 'CVV2' => $data['CVVCode']);
         $result = $app->validateCard($card);
         if ($result['Valid'] == 'false') {
             return "inlineMsg5";
         }
         $ccData = array('ContactId' => $isConID, 'FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'BillAddress1' => $data['StreetAddress1'], 'BillAddress2' => $data['StreetAddress2'], 'BillCity' => $data['City'], 'BillState' => $data['State'], 'BillZip' => $data['PostalCode'], 'BillCountry' => $country, 'CardType' => $creditCardType, 'NameOnCard' => $data['NameOnCard'], 'CardNumber' => $data['CreditCardNumber'], 'CVV2' => $data['CVVCode'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear']);
         $ccID = $app->dsAdd("CreditCard", $ccData);
     }
     // Create AttentionWizard member
     $member = new Member();
     $member->FirstName = $data['FirstName'];
     $member->Surname = $data['LastName'];
     $member->Email = $data['Email'];
     $member->Password = $data['Password']['_Password'];
     $member->ISContactID = $isConID;
     $memberID = $member->write();
     //Find or create the 'user' group
     if (!($userGroup = DataObject::get_one('Group', "Code = 'customers'"))) {
         $userGroup = new Group();
         $userGroup->Code = "customers";
         $userGroup->Title = "Customers";
         $userGroup->Write();
     }
     //Add member to user group
     $userGroup->Members()->add($member);
     //Get the current date
     $curdate = $app->infuDate(date('j-n-Y'));
     $product = Product::get()->byID(7);
     // Store credit card info
     $creditCard = new CreditCard();
     $creditCard->CreditCardType = $data['CreditCardType'];
     $creditCard->CreditCardNumber = $data['CreditCardNumber'];
     $creditCard->NameOnCard = $data['NameOnCard'];
     $creditCard->CreditCardCVV = $data['CVVCode'];
     $creditCard->ExpiryMonth = $data['ExpirationMonth'];
     $creditCard->ExpiryYear = $data['ExpirationYear'];
     $creditCard->Company = $data['Company'];
     $creditCard->StreetAddress1 = $data['StreetAddress1'];
     $creditCard->StreetAddress2 = $data['StreetAddress2'];
     $creditCard->City = $data['City'];
     $creditCard->State = $data['State'];
     $creditCard->PostalCode = $data['PostalCode'];
     $creditCard->Country = $data['Country'];
     $creditCard->Current = 1;
     $creditCard->ISCCID = $ccID;
     $creditCard->MemberID = $memberID;
     $creditCardID = $creditCard->write();
     // Create an Infusionsoft order
     $config = SiteConfig::current_site_config();
     $invoiceId = $app->blankOrder($isConID, $product->Name, $curdate, 0, 0);
     $orderItem = $app->addOrderItem($invoiceId, $this->getNonExpiringIsProductId(7), 3, floatval($data['Price']), intval($data['Quantity']), $product->Name, $product->Name);
     $result = $app->chargeInvoice($invoiceId, $product->Name, $ccID, $config->MerchantAccount, false);
     // Create an order
     $order = new Order();
     $order->OrderStatus = 'P';
     $order->Amount = $data['Price'] * $data['Quantity'];
     $order->MemberID = $memberID;
     $order->ProductID = 7;
     $order->CreditCardID = $creditCardID;
     $orderID = $order->write();
     $returnFields = array('_AttentionWizard', 'Leadsource');
     $conDat1 = $app->loadCon($isConID, $returnFields);
     if ($result['Successful']) {
         // Add tag Paid member - prepaid
//.........這裏部分代碼省略.........
開發者ID:hemant-chakka,項目名稱:awss,代碼行數:101,代碼來源:PrepaidSignup.php

示例10: logInWithPermssion

 /**
  * Create a member and group with the given permission code, and log in with it.
  * Returns the member ID.
  */
 function logInWithPermssion($permCode = "ADMIN")
 {
     if (!isset($this->cache_generatedMembers[$permCode])) {
         $group = new Group();
         $group->Title = "{$permCode} group";
         $group->write();
         $permission = new Permission();
         $permission->Code = $permCode;
         $permission->write();
         $group->Permissions()->add($permission);
         $member = new Member();
         $member->FirstName = $permCode;
         $member->Surname = "User";
         $member->Email = "{$permCode}@example.org";
         $member->write();
         $group->Members()->add($member);
         $this->cache_generatedMembers[$permCode] = $member;
     }
     $this->cache_generatedMembers[$permCode]->logIn();
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:24,代碼來源:SapphireTest.php

示例11: createSubscription

 public function createSubscription($data, $form)
 {
     //Get member id
     $memberId = $data['MemberID'];
     //Get product id
     $productId = $data['ProductID'];
     // Get the Page controller
     $Page_Ctrl = new Page_Controller();
     //Get InfusionSoft Api
     $app = $Page_Ctrl->getInfusionSoftApi();
     // Get curent date
     $curdate = $app->infuDate(date('j-n-Y'));
     $member = Member::get()->byID($memberId);
     //Find or create the 'user' group and add the member to the group
     if (!($userGroup = DataObject::get_one('Group', "Code = 'customers'"))) {
         $userGroup = new Group();
         $userGroup->Code = "customers";
         $userGroup->Title = "Customers";
         $userGroup->Write();
         $userGroup->Members()->add($member);
     } else {
         $userGroup->Members()->add($member);
     }
     $isConID = $member->ISContactID;
     $product = Product::get()->byID($productId);
     // Get existing credit card ID
     $creditCard = $Page_Ctrl->getCurrentCreditCard($memberId);
     // Get the current InfusionSoft credit card ID
     $ccID = $creditCard->ISCCID;
     //Get siteconfig object
     $config = SiteConfig::current_site_config();
     //Process non-expiring heatmaps purchase
     if ($productId == 4 || $productId == 5 || $productId == 6 || $productId == 7) {
         if (!$data['Quantity']) {
             $form->addErrorMessage('Quantity', "Quantity is required for non-expiring products.", 'bad');
             return $this->edit(Controller::curr()->getRequest());
         }
         // Create an Infusionsoft order
         $invoiceId = $app->blankOrder($isConID, $product->Name, $curdate, 0, 0);
         $orderItem = $app->addOrderItem($invoiceId, intval($Page_Ctrl->getNonExpiringIsProductId($data['ProductID'])), 3, floatval($product->Price), intval($data['Quantity']), $product->Name, $product->Name);
         $result = $app->chargeInvoice($invoiceId, $product->Name, $ccID, $config->MerchantAccount, false);
         // Create an order
         $order = new Order();
         $order->OrderStatus = 'P';
         $order->Amount = $product->Price * $data['Quantity'];
         $order->MemberID = $member->ID;
         $order->ProductID = $data['ProductID'];
         $order->CreditCardID = $creditCard->ID;
         $orderID = $order->write();
         if ($result['Successful']) {
             // Add tag Paid member - prepaid
             $app->grpAssign($isConID, 2290);
             $conDat = array('ContactType' => 'AW Customer');
             $returnFields = array('_AttentionWizard');
             $conDat1 = $app->loadCon($isConID, $returnFields);
             if (isset($conDat1['_AttentionWizard']) && $conDat1['_AttentionWizard'] != 'Paid and Current' && $conDat1['_AttentionWizard'] != 'Free') {
                 $conDat['_AttentionWizard'] = 'Prepaid only - no subscription';
             }
             if (!isset($conDat1['_AttentionWizard'])) {
                 $conDat['_AttentionWizard'] = 'Prepaid only - no subscription';
             }
             $conID = $app->updateCon($isConID, $conDat);
             // Note is added
             $conActionDat = array('ContactId' => $isConID, 'ActionType' => 'UPDATE', 'ActionDescription' => "Purchased AW Prepaid Credits", 'CreationDate' => $curdate, 'ActionDate' => $curdate, 'CompletionDate' => $curdate, 'UserID' => 1);
             $conActionID = $app->dsAdd("ContactAction", $conActionDat);
             // Update order
             $order->OrderStatus = 'c';
             $order->write();
             // Create a Subscription record
             $subscription = new Subscription();
             $subscription->StartDate = date("Y-m-d H:i:s");
             $subscription->MemberID = $member->ID;
             $subscription->ProductID = $data['ProductID'];
             $subscription->OrderID = $orderID;
             $subscription->write();
             // Create a MemberCredits record
             $memberCredits = new MemberCredits();
             $memberCredits->Credits = $product->Credits * $data['Quantity'];
             $memberCredits->MemberID = $member->ID;
             $memberCredits->ProductID = $product->ID;
             $memberCredits->SubscriptionID = $subscription->ID;
             $memberCredits->write();
             $form->sessionMessage("Purchased non-expiring heatmaps successfully.", 'good');
             return Controller::curr()->redirect("admin/manage-data/Subscription/EditForm/field/Subscription/item/{$subscription->ID}/edit");
         } else {
             // Add an AW prospect tag
             $app->grpAssign($isConID, $Page_Ctrl->getISTagIdByPaymentCode(strtoupper($result['Code'])));
             // Add a note
             $conActionDat = array('ContactId' => $isConID, 'ActionType' => 'UPDATE', 'ActionDescription' => "Unsuccessful attempt to purchase prepaid plan", 'CreationDate' => $curdate, 'ActionDate' => $curdate, 'CompletionDate' => $curdate, 'UserID' => 1);
             $conActionID = $app->dsAdd("ContactAction", $conActionDat);
             $form->sessionMessage("Sorry,the payment failed,please update the user credit card.", 'bad');
             return $this->edit(Controller::curr()->getRequest());
         }
     }
     //Process subscriptions
     if ($productId == 1 || $productId == 2 || $productId == 3) {
         $credits = $product->Credits;
         $subscriptionID = $Page_Ctrl->createISSubscription($isConID, $product->ISProductID, $product->RecurringPrice, $ccID, 30);
         if ($subscriptionID && is_int($subscriptionID)) {
             if ($productId == 1 && !$Page_Ctrl->isCCUsedForTrial($creditCard->CreditCardNumber)) {
//.........這裏部分代碼省略.........
開發者ID:hemant-chakka,項目名稱:awss,代碼行數:101,代碼來源:DataAdmin.php

示例12: doSignup

 function doSignup()
 {
     $data = $_POST;
     //Stop sign-up if the user does not check the chebox
     if (!isset($data['Agreement'])) {
         return "inlineMsg5";
     }
     if ($this->isCCUsedForTrial("{$data['CreditCardNumber']}") && $data['SubscriptionType'] == 1) {
         return "inlineMsg1";
     }
     $currentYear = date('Y');
     $currentMonth = date('n');
     //Stop sign-up when the credit card is expired
     if ($data['ExpirationYear'] < $currentYear) {
         return "inlineMsg4";
     }
     if ($data['ExpirationYear'] == $currentYear) {
         if ($data['ExpirationMonth'] < $currentMonth) {
             return "inlineMsg4";
         }
     }
     //Get InfusionSoft Api
     $app = $this->getInfusionSoftApi();
     //Get current date
     $curdate = $app->infuDate(date('j-n-Y'));
     //Get the registration form from session
     $regFormData = Session::get('RegistrationFormData');
     // Get country text from code
     $country = Geoip::countryCode2name($data['Country']);
     // Get InfusionSoft Contact ID
     $returnFields = array('Id', 'Leadsource');
     $conInfo = $app->findByEmail($regFormData['Email'], $returnFields);
     if (empty($conInfo)) {
         // If IS contact doesn't exist create one
         $conDat = array('FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'Company' => $data['Company'], 'StreetAddress1' => $data['StreetAddress1'], 'StreetAddress2' => $data['StreetAddress2'], 'City' => $data['City'], 'State' => $data['State'], 'PostalCode' => $data['PostalCode'], 'Country' => $country, 'Email' => $regFormData['Email']);
         if (empty($conInfo)) {
             $conDat['Leadsource'] = 'AttentionWizard';
         }
         $isConID = $app->addCon($conDat);
     } else {
         $isConID = $conInfo[0]['Id'];
     }
     // Locate existing credit card
     $ccID = $app->locateCard($isConID, substr($data['CreditCardNumber'], -4, 4));
     $creditCardType = $this->getISCreditCardType($data['CreditCardType']);
     if (!$ccID) {
         //Validate the credit card
         $card = array('CardType' => $creditCardType, 'ContactId' => $isConID, 'CardNumber' => $data['CreditCardNumber'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear'], 'CVV2' => $data['CVVCode']);
         $result = $app->validateCard($card);
         if ($result['Valid'] == 'false') {
             return "inlineMsg3";
         }
         $ccData = array('ContactId' => $isConID, 'FirstName' => $data['FirstName'], 'LastName' => $data['LastName'], 'BillAddress1' => $data['StreetAddress1'], 'BillAddress2' => $data['StreetAddress2'], 'BillCity' => $data['City'], 'BillState' => $data['State'], 'BillZip' => $data['PostalCode'], 'BillCountry' => $country, 'CardType' => $creditCardType, 'NameOnCard' => $data['NameOnCard'], 'CardNumber' => $data['CreditCardNumber'], 'CVV2' => $data['CVVCode'], 'ExpirationMonth' => sprintf("%02s", $data['ExpirationMonth']), 'ExpirationYear' => $data['ExpirationYear']);
         $ccID = $app->dsAdd("CreditCard", $ccData);
     }
     // Create AttentionWizard member
     $member = new Member();
     $member->FirstName = $data['FirstName'];
     $member->Surname = $data['LastName'];
     $member->Email = $regFormData['Email'];
     $member->Password = $regFormData['Password']['_Password'];
     $member->ISContactID = $isConID;
     $memberID = $member->write();
     //Find or create the 'user' group and add the member to the group
     if (!($userGroup = DataObject::get_one('Group', "Code = 'customers'"))) {
         $userGroup = new Group();
         $userGroup->Code = "customers";
         $userGroup->Title = "Customers";
         $userGroup->Write();
         $userGroup->Members()->add($member);
     } else {
         $userGroup->Members()->add($member);
     }
     //Get product details
     $product = Product::get()->byID($data['SubscriptionType']);
     $credits = $product->Credits;
     if ($data['SubscriptionType'] == 1) {
         $orderAmount = $product->TrialPrice;
         $productName = "30 days 1-dollar Trial";
         $isProductID = 38;
     } else {
         $productName = $product->Name;
         $orderAmount = $product->RecurringPrice;
         $isProductID = $product->ISInitialProductID;
     }
     // Store credit card info
     $creditCard = new CreditCard();
     $creditCard->CreditCardType = $data['CreditCardType'];
     $creditCard->CreditCardNumber = $data['CreditCardNumber'];
     $creditCard->NameOnCard = $data['NameOnCard'];
     $creditCard->CreditCardCVV = $data['CVVCode'];
     $creditCard->ExpiryMonth = $data['ExpirationMonth'];
     $creditCard->ExpiryYear = $data['ExpirationYear'];
     $creditCard->Company = $data['Company'];
     $creditCard->StreetAddress1 = $data['StreetAddress1'];
     $creditCard->StreetAddress2 = $data['StreetAddress2'];
     $creditCard->City = $data['City'];
     $creditCard->State = $data['State'];
     $creditCard->PostalCode = $data['PostalCode'];
     $creditCard->Country = $data['Country'];
//.........這裏部分代碼省略.........
開發者ID:hemant-chakka,項目名稱:awss,代碼行數:101,代碼來源:TrialSignup.php


注:本文中的Group::Members方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。