/**
	 * These actions are performed when write() is called on this object.
	 */
	public function onBeforeWrite() {
		// save submitter if a Member is logged in
		$currentMember = Member::currentMember();
		if(!$this->SubmitterID && $currentMember) $this->SubmitterID = $currentMember->ID;
		
		parent::onBeforeWrite();
	}
    public function getModifierForm($optionalController = null, $optionalValidator = null)
    {
        $fields = new FieldSet();
        $fields->push($this->headingField());
        $fields->push($this->descriptionField());
        $orderID = Session::get('RepeatOrder');
        $createLink = RepeatOrdersPage::get_repeat_order_link('createorder');
        if ($orderID && Member::currentMember()) {
            $order = DataObject::get_by_id('RepeatOrder', $orderID);
            $updateLink = RepeatOrdersPage::get_repeat_order_link('update', $orderID);
            $cancelLink = RepeatOrdersPage::get_repeat_order_link('cancel', $orderID);
            if ($order->CanModify()) {
                $fields->push(new LiteralField('modifyRepeatOrder', <<<HTML
\t\t\t\t\t<div class="Actions"><input id="ModifyRepeatOrderUpdate"  class="action" type="button" value="Save changes to your Repeat Order #{$orderID}" onclick="window.location='{$updateLink}';" /></div>
HTML
));
            } else {
                $fields->push(new LiteralField('createRepeatOrder', <<<HTML
\t\t\t\t\t\t<div class="Actions"><input id="ModifyRepeatOrderCreate" class="action" type="button" value="Create a new Repeat Order" onclick="window.location='{$createLink}';" /></div>
HTML
));
            }
            Requirements::customScript("jQuery(document).ready(function(){jQuery(\"input[name='action_processOrder']\").hide();});", "hide_action_processOrder");
        } else {
            if (Member::currentMember()) {
                if (!Session::get("DraftOrderID")) {
                    $fields->push(new LiteralField('createRepeatOrder', <<<HTML
\t\t\t\t\t<div class="Actions"><input  id="ModifyRepeatOrderCreate" class="action" type="button" value="Turn this Order into a Repeat Order" onclick="window.location='{$createLink}';" /></div>
HTML
));
                    $page = DataObject::get_one("RepeatOrdersPage");
                    if ($page) {
                        $fields->push(new LiteralField("whatAreRepeatOrders", <<<HTML
\t\t\t\t\t<div id="WhatAreRepeatOrders">{$page->WhatAreRepeatOrders}</div>
HTML
));
                    }
                } else {
                    $fields->push(new LiteralField("whatAreRepeatOrders", <<<HTML
\t\t\t\t\t<div id="WhatAreRepeatOrders">This order is based on a Repeat Order.</div>
HTML
));
                }
            } else {
                $page = DataObject::get_one("RepeatOrdersPage");
                if ($page) {
                    $fields->push(new LiteralField("whatAreRepeatOrders", <<<HTML
\t\t\t\t\t<div id="WhatAreRepeatOrders">{$page->OnceLoggedInYouCanCreateRepeatOrder}</div>
HTML
));
                }
            }
        }
        return new RepeatOrderModifier_Form($optionalController, 'RepeatOrderModifier', $fields, new FieldSet(), $optionalValidator);
    }
Beispiel #3
0
	function onBeforeWrite() {
		if(!$this->ID) {
			$category = $this->JobCategory();
			$this->notifySubscribers($category->Subscribers());	
			
			$currentMember = Member::currentMember();
			if($currentMember) $this->AuthorID = $currentMember->ID;
		}

		parent::onBeforeWrite();
	}
 function __construct($controller, $name)
 {
     Requirements::javascript(ECOMMERCE_DIR . '/javascript/OrderFormWithoutShippingAddress.js');
     parent::__construct($controller, $name);
     //stop people adding different shipping address
     $this->unsetActionByName("action_useDifferentShippingAddress");
     $this->unsetActionByName("useDifferentShippingAddress");
     $member = Member::currentMember();
     if (!$member || !$member->ID || $member->Password == '') {
         $this->fields->addFieldToTab("", new LiteralField('MemberInfoAlso', '<p class="message good LoginCallToAction">' . self::get_login_invite_alternative_text() . '</p>', $this), "FirstName");
         //improve password field TEMPORARY HACK!
         //$passwordField = new OptionalConfirmedPasswordField('Password', 'Password', '', null, true);
         //$passwordField->minLength = 6;
         //$passwordField->showOnClickTitle = "add password now";
         //$this->fields->replaceField("Password", $passwordField);
         Requirements::javascript(ECOMMERCE_DIR . '/javascript/OptionalConfirmedPasswordField.js');
         Requirements::block(SAPPHIRE_DIR . '/javascript/ConfirmedPasswordField.js');
     }
     $this->fields->removeFieldFromTab("RightOrder", "MemberInfo");
     //add extra fields
     foreach (self::$extra_fields as $fieldCombo) {
         $fieldCombo["FieldObject"]->setForm($this);
         $this->fields->addFieldToTab($fieldCombo["TabName"], $fieldCombo["FieldObject"]);
     }
     //replace field for address
     foreach ($this->fields->dataFields() as $i => $child) {
         if (is_object($child)) {
             $name = $child->Name();
             switch ($name) {
                 case "Membership Details":
                     $child->setTitle('Retain Personal Details with Password');
                     break;
                 case "Address":
                     $child->setTitle('Street Address');
                     break;
                 case "AddressLine2":
                     $child->setRightTitle('<a href="' . self::$postal_code_url . '" id="OrderFormWithoutShippingAddressPostalCodeLink">' . self::$postal_code_label . '</a>');
                     $child->setTitle('Postal Code');
                     break;
                 case "Country":
                     if (self::$fixed_country_code) {
                         $child->setValue(self::$fixed_country_code);
                         ShoppingCart::set_country(self::$fixed_country_code);
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     $this->fields->addFieldToTab("", new TextareaField('CustomerOrderNote', 'Note / Question', 7, 30, null, $this));
     $data = $this->getData();
     $this->loadDataFrom($data);
 }
 /** PHP Validation **/
 function validate($validator)
 {
     $string = $this->value;
     $validator = new NZGovtPasswordValidator();
     $member = Member::currentMember();
     if (!$member) {
         $member = new Member();
         $member->ID = 0;
     }
     $outcome = $validator->validate($string, $member);
     if ($outcome->valid()) {
         return true;
     } else {
         $validator->validationError($this->name, "There is a problem with your password: it needs to contain at least seven characters including at least one uppercase, lowercase, digit and one punctuation character (e.g. Hu#9iowD is a valid password and Abababaa is not).", "validation");
         return false;
     }
 }
 /**
  * Authentication is handled by Facebook rather than us this needs to 
  * return the new member object which is created. Creation of the member
  * is handled by {@link FacebookConnect::onBeforeInt()}
  *
  * @return false|Member
  */
 public static function authenticate($RAW_data, Form $form = null)
 {
     return ($member = Member::currentMember()) ? $member : false;
 }
 /**
  * Authenticates the user.
  *
  * @return bool|Member
  *
  * @author Sascha Koehler <*****@*****.**>
  * @since 2013-02-22
  */
 protected function authenticate()
 {
     $serverAuth = $this->checkServerLoginCredentials();
     if (!$serverAuth) {
         if ($member = Member::currentMember()) {
             return $member;
         } else {
             return false;
         }
     }
     $member = MemberAuthenticator::authenticate(array('Email' => $serverAuth['PHP_AUTH_USER'], 'Password' => $serverAuth['PHP_AUTH_PW']), null);
     if ($member) {
         $member->LogIn(false);
         return $member;
     } else {
         return false;
     }
 }
 /**
  * work out the options for the user
  * @return void
  **/
 protected function workOutMessagesAndActions()
 {
     if (!$this->workedOutMessagesAndActions) {
         $this->actionLinks = new DataObjectSet();
         //what order are we viewing?
         $viewingRealCurrentOrder = $this->CurrentOrderIsInCart();
         $currentUserID = Member::currentUserID();
         //Continue Shopping
         if (isset($this->ContinueShoppingLabel) && $this->ContinueShoppingLabel) {
             if ($viewingRealCurrentOrder) {
                 if ($this->isCartPage()) {
                     $continuePage = DataObject::get_by_id("SiteTree", $this->ContinuePageID);
                     if ($continuePage) {
                         $this->actionLinks->push(new ArrayData(array("Title" => $this->ContinueShoppingLabel, "Link" => $continuePage->Link())));
                     }
                 }
             }
         }
         //Proceed To CheckoutLabel
         if (isset($this->ProceedToCheckoutLabel) && $this->ProceedToCheckoutLabel) {
             if ($viewingRealCurrentOrder) {
                 if ($this->isCartPage()) {
                     $checkoutPageLink = CheckoutPage::find_link();
                     if ($checkoutPageLink && $this->currentOrder && $this->currentOrder->Items()) {
                         $this->actionLinks->push(new ArrayData(array("Title" => $this->ProceedToCheckoutLabel, "Link" => $checkoutPageLink)));
                     }
                 }
             }
         }
         //view account details
         if (isset($this->ShowAccountLabel) && $this->ShowAccountLabel) {
             if ($this->isOrderConfirmationPage() || $this->isCartPage()) {
                 if (AccountPage::find_link()) {
                     if ($currentUserID) {
                         $this->actionLinks->push(new ArrayData(array("Title" => $this->ShowAccountLabel, "Link" => AccountPage::find_link())));
                     }
                 }
             }
         }
         //go to current order
         if (isset($this->CurrentOrderLinkLabel) && $this->CurrentOrderLinkLabel) {
             if ($this->isCartPage()) {
                 if (!$viewingRealCurrentOrder) {
                     $this->actionLinks->push(new ArrayData(array("Title" => $this->CurrentOrderLinkLabel, "Link" => ShoppingCart::current_order()->Link())));
                 }
             }
         }
         //Save order - we assume only current ones can be saved.
         if (isset($this->SaveOrderLinkLabel) && $this->SaveOrderLinkLabel) {
             if ($viewingRealCurrentOrder) {
                 if ($currentUserID && $this->currentOrder->MemberID == $currentUserID) {
                     if ($this->isCartPage()) {
                         if ($this->currentOrder && $this->currentOrder->Items() && !$this->currentOrder->IsSubmitted()) {
                             $this->actionLinks->push(new ArrayData(array("Title" => $this->SaveOrderLinkLabel, "Link" => $this->Link("saveorder") . "/" . $this->currentOrder->ID . "/")));
                         }
                     }
                 }
             }
         }
         //load order
         if (isset($this->LoadOrderLinkLabel) && $this->LoadOrderLinkLabel) {
             if ($this->isCartPage() && $this->currentOrder) {
                 if (!$viewingRealCurrentOrder) {
                     $this->actionLinks->push(new ArrayData(array("Title" => $this->LoadOrderLinkLabel, "Link" => $this->Link("loadorder") . "/" . $this->currentOrder->ID . "/")));
                 }
             }
         }
         //delete order
         if (isset($this->DeleteOrderLinkLabel) && $this->DeleteOrderLinkLabel) {
             if ($this->isCartPage() && $this->currentOrder) {
                 if (!$viewingRealCurrentOrder) {
                     $this->actionLinks->push(new ArrayData(array("Title" => $this->DeleteOrderLinkLabel, "Link" => $this->Link("deleteorder") . "/" . $this->currentOrder->ID . "/")));
                 }
             }
         }
         //Start new order
         //Strictly speaking this is only part of the
         //OrderConfirmationPage but we put it here for simplicity's sake
         if (isset($this->StartNewOrderLinkLabel) && $this->StartNewOrderLinkLabel) {
             if ($this->isOrderConfirmationPage()) {
                 $this->actionLinks->push(new ArrayData(array("Title" => $this->StartNewOrderLinkLabel, "Link" => CartPage::new_order_link())));
             }
         }
         //copy order
         //Strictly speaking this is only part of the
         //OrderConfirmationPage but we put it here for simplicity's sake
         if (isset($this->CopyOrderLinkLabel) && $this->CopyOrderLinkLabel) {
             if ($this->isOrderConfirmationPage() && $this->currentOrder->ID) {
                 $this->actionLinks->push(new ArrayData(array("Title" => $this->CopyOrderLinkLabel, "Link" => OrderConfirmationPage::new_order_link($this->currentOrder->ID))));
             }
         }
         //actions from modifiers
         if ($this->isOrderConfirmationPage() && $this->currentOrder->ID) {
             $modifiers = $this->currentOrder->OrderModifiers();
             if ($modifiers) {
                 foreach ($modifiers as $modifier) {
                     $array = $modifier->PostSubmitAction();
                     if (is_array($array) && count($array)) {
                         $this->actionLinks->push(new ArrayData($array));
                     }
                 }
             }
         }
         //log out
         //Strictly speaking this is only part of the
         //OrderConfirmationPage but we put it here for simplicity's sake
         if (Member::currentMember()) {
             if ($this->isOrderConfirmationPage()) {
                 $this->actionLinks->push(new ArrayData(array("Title" => _t("CartPage.LOGOUT", "log out"), "Link" => "/Security/logout/")));
             }
         }
         //no items
         if ($this->currentOrder) {
             if (!$this->currentOrder->Items()) {
                 $this->message = $this->NoItemsInOrderMessage;
             }
         } else {
             $this->message = $this->NonExistingOrderMessage;
         }
         $this->workedOutMessagesAndActions = true;
         //does nothing at present....
     }
 }
Beispiel #9
0
 /**
  * Returns a member linked to the order.
  * If a member is already linked, it will return the existing member.
  * Otherwise it will return a new Member.
  *
  * Any new member is NOT written, because we dont want to create a new member unless we have to!
  * We will not add a member to the order unless a new one is created in the checkout
  * OR the member is logged in / logs in.
  *
  * Also note that if a new member is created, it is not automatically written
  * @param Boolean $forceCreation - if set to true then the member will always be saved in the database.
  * @return: DataObject (Member)
  **/
 public function CreateOrReturnExistingMember($forceCreation = false)
 {
     if ($this->MemberID) {
         $member = $this->Member();
     } elseif ($member = Member::currentMember()) {
         if (!$member->IsShopAdmin()) {
             $this->MemberID = $member->ID;
             $this->write();
         }
     }
     $member = $this->Member();
     if (!$member) {
         $member = new Member();
     }
     if ($member && $forceCreation) {
         $member->write();
     }
     return $member;
 }
 protected function authenticate()
 {
     if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
         return false;
     }
     if ($member = Member::currentMember()) {
         return $member;
     }
     $member = MemberAuthenticator::authenticate(array('Email' => $_SERVER['PHP_AUTH_USER'], 'Password' => $_SERVER['PHP_AUTH_PW']), null);
     if ($member) {
         $member->LogIn(false);
         return $member;
     } else {
         return false;
     }
 }
 function createnewbusinesslistingfrompoint($request)
 {
     if (!isset($_GET["address"])) {
         $addressArray = array();
         $address = '';
     } else {
         $addressArray = unserialize($_GET["address"]);
         $address = $addressArray["address"];
     }
     if (!isset($_GET["name"])) {
         $name = '';
     } else {
         $name = Convert::raw2xml($_GET["name"]);
     }
     if (!isset($_GET["parent"])) {
         $parent = 0;
     } else {
         $parent = intval($_GET["parent"]);
     }
     if ($member = Member::currentMember()) {
         if ($name) {
             if ($parent && ($parentPage = DataObject::get_by_id("SiteTree", $parent))) {
                 if ($address && count($addressArray)) {
                     $allowedParents = BusinessPage::get_can_be_child_off();
                     if (is_array($allowedParents) && in_array($parentPage->ClassName, $allowedParents)) {
                         $extension = '';
                         if (Versioned::current_stage() == "Live") {
                             $extension = "_Live";
                         }
                         $page = DataObject::get_one("BusinessPage", "ParentID = " . $parentPage->ID . " AND SiteTree{$extension}.Title = '" . Convert::raw2sql($name) . "'");
                         if ($page) {
                             //do nothing
                         } else {
                             $page = new BusinessPage();
                             $page->Title = $name;
                             $page->MenuTitle = $name;
                             $page->MetaTitle = $name;
                             $page->Email = $member->Email;
                             $page->ParentID = $parentPage->ID;
                             $page->writeToStage('Stage');
                             $page->publish('Stage', 'Live');
                             $page->flushCache();
                             $page->Members()->add($member);
                             $member->addToGroupByCode(BusinessPage::get_member_group_code());
                         }
                         $point = new GoogleMapLocationsObject();
                         $point->addDataFromArray($addressArray);
                         $point->ParentID = $page->ID;
                         $point->write();
                         Director::redirect($page->Link());
                         return;
                     } else {
                         Director::redirect($this->linkWithExtras(array("address" => $address, "name" => $name, "error" => "Could not find correct parent page type ")));
                         return;
                     }
                 } else {
                     Director::redirect($this->linkWithExtras(array("address" => $address, "name" => $name, "error" => "Could not find address page.")));
                     return;
                 }
             } else {
                 Director::redirect($this->linkWithExtras(array("address" => $address, "name" => $name, "error" => "Could not find parent page.")));
                 return;
             }
         }
         Director::redirect($this->linkWithExtras(array("address" => $address, "name" => $name, "error" => "Could not find listing name.")));
         return;
     } else {
         Security::permissionFailure($this, "You must have an account and be logged in to create new a new listing.");
     }
 }
 static function hasMainSitePermission($member = null, $permissionCodes = array('ADMIN'))
 {
     if (!is_array($permissionCodes)) {
         user_error('Permissions must be passed to Subsite::hasMainSitePermission as an array', E_USER_ERROR);
     }
     if (!$member && $member !== FALSE) {
         $member = Member::currentMember();
     }
     if (!$member) {
         return false;
     }
     if (!in_array("ADMIN", $permissionCodes)) {
         $permissionCodes[] = "ADMIN";
     }
     $SQLa_perm = Convert::raw2sql($permissionCodes);
     $SQL_perms = join("','", $SQLa_perm);
     $memberID = (int) $member->ID;
     $groupCount = DB::query("\n\t\t\tSELECT COUNT(\"Permission\".\"ID\")\n\t\t\tFROM \"Permission\"\n\t\t\tINNER JOIN \"Group\" ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1\n\t\t\tINNER JOIN \"Group_Members\" ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"\n\t\t\tWHERE \"Permission\".\"Code\" IN ('{$SQL_perms}')\n\t\t\tAND \"MemberID\" = {$memberID}\n\t\t")->value();
     return $groupCount > 0;
 }
Beispiel #13
0
 /**
  * A simple form for creating blog entries
  */
 function BlogEntryForm()
 {
     if (!Permission::check('BLOGMANAGEMENT')) {
         return Security::permissionFailure();
     }
     $id = 0;
     if ($this->request->latestParam('ID')) {
         $id = (int) $this->request->latestParam('ID');
     }
     $codeparser = new BBCodeParser();
     $membername = Member::currentMember() ? Member::currentMember()->getName() : "";
     if (BlogEntry::$allow_wysiwyg_editing) {
         $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN"));
     } else {
         $contentfield = new CompositeField(new LiteralField("BBCodeHelper", "<a id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH") . "</a><div class='clear'><!-- --></div>"), new TextareaField("BlogPost", _t("BlogEntry.CN"), 20), new LiteralField("BBCodeTags", "<div id=\"BBTagsHolder\">" . $codeparser->useable_tagsHTML() . "</div>"));
     }
     if (class_exists('TagField')) {
         $tagfield = new TagField('Tags', null, null, 'BlogEntry');
         $tagfield->setSeparator(', ');
     } else {
         $tagfield = new TextField('Tags');
     }
     $field = 'TextField';
     if (!$this->AllowCustomAuthors && !Permission::check('ADMIN')) {
         $field = 'ReadonlyField';
     }
     $fields = new FieldSet(new HiddenField("ID", "ID"), new TextField("Title", _t('BlogHolder.SJ', "Subject")), new $field("Author", _t('BlogEntry.AU'), $membername), $contentfield, $tagfield, new LiteralField("Tagsnote", " <label id='tagsnote'>" . _t('BlogHolder.TE', "For example: sport, personal, science fiction") . "<br/>" . _t('BlogHolder.SPUC', "Please separate tags using commas.") . "</label>"));
     $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry'));
     $actions = new FieldSet($submitAction);
     $validator = new RequiredFields('Title', 'BlogPost');
     $form = new Form($this, 'BlogEntryForm', $fields, $actions, $validator);
     if ($id != 0) {
         $entry = DataObject::get_by_id('BlogEntry', $id);
         if ($entry->IsOwner()) {
             $form->loadDataFrom($entry);
             $form->datafieldByName('BlogPost')->setValue($entry->Content);
         }
     } else {
         $form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name")));
     }
     return $form;
 }
Beispiel #14
0
	/**
	 * A simple form for creating blog entries
	 */
	function BlogEntryForm() {
		if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure();

		Requirements::javascript('jsparty/behaviour.js');
		Requirements::javascript('jsparty/prototype.js');
		Requirements::javascript('jsparty/scriptaculous/effects.js');
		Requirements::javascript('cms/javascript/PageCommentInterface.js');
		Requirements::javascript('blog/javascript/bbcodehelp.js');
					
		$id = 0;
		if(Director::urlParam('ID')) {
			$id = (int) Director::urlParam('ID');
		}
		
		$codeparser = new BBCodeParser();
		$membername = Member::currentMember() ? Member::currentMember()->getName() : "";
		
		if(BlogEntry::$allow_wysiwyg_editing) {
			$contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN"));
		} else {
			$contentfield = new CompositeField( 
				new LiteralField("BBCodeHelper","<a id=\"BBCodeHint\" target='new'>"._t("BlogEntry.BBH")."</a><div class='clear'><!-- --></div>" ),
				new TextareaField("BlogPost", _t("BlogEntry.CN"),20), // This is called BlogPost as the id #Content is generally used already
				new LiteralField("BBCodeTags","<div id=\"BBTagsHolder\">".$codeparser->useable_tagsHTML()."</div>")
			);
		}
		
		if(class_exists('TagField')) {
			$tagfield = new TagField('Tags', null, null, 'BlogEntry');
			$tagfield->setSeparator(', ');
		} else {
			$tagfield = new TextField('Tags');
		}
		
		$fields = new FieldSet(
			new HiddenField("ID", "ID"),
			new TextField("Title",_t('BlogHolder.SJ', "Subject")),
			new TextField("Author",_t('BlogEntry.AU'),$membername),
			$contentfield,
			$tagfield,
			new LiteralField("Tagsnote"," <label id='tagsnote'>"._t('BlogHolder.TE', "For example: sport, personal, science fiction")."<br/>" .
												_t('BlogHolder.SPUC', "Please separate tags using commas.")."</label>")
		);	
		
		$submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry'));
		$actions = new FieldSet($submitAction);
		$validator = new RequiredFields('Title','Content');
			
		$form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator);
	
		if($id != 0) {
			$entry = DataObject::get_by_id('BlogEntry', $id);
			$form->loadNonBlankDataFrom($entry);
			$form->datafieldByName('BlogPost')->setValue($entry->Content);
		} else {
			$form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name")));
		}
		
		return $form;
	}
 /**
  * returns a real or fake member against which we save the wishlist.
  * @return Member | WishListMember
  */
 static function get_member_for_wishlist()
 {
     $member = Member::currentMember();
     if (!$member) {
         $wishListMemberID = Session::get(self::get_session_variable_name() . "_wishListMemberID");
         if ($wishListMemberID) {
             if ($wishListMember = DataObject::get_by_id("WishListMember", intval($wishListMemberID))) {
                 //do nothing
             } else {
                 $wishListMemberID = null;
             }
         }
         if (!$wishListMemberID) {
             $wishListMember = new WishListMember();
             $wishListMember->write();
             Session::set(self::get_session_variable_name() . "_wishListMemberID", $wishListMember->ID);
         }
         return $wishListMember;
     } else {
         //copy if the member does not have a wish list, but the session does.
         if (!$member->WishList) {
             if (!$member->IsAdmin()) {
                 $wishListMemberID = Session::get(self::get_session_variable_name() . "_wishListMemberID");
                 if ($wishListMemberID) {
                     if ($wishListMember = DataObject::get_by_id("WishListMember", intval($wishListMemberID))) {
                         if ($wishListMember->WishList) {
                             $member->WishList = $wishListMember->WishList;
                             $member->write();
                         }
                         $wishListMember->delete();
                         Session::clear(self::get_session_variable_name() . "_wishListMemberID");
                     }
                 }
             }
         }
         return $member;
     }
 }