/** * Creates a customer record (and WordPress user) and attaches the order to it * * @author Jonathan Davis * @since 1.2 * * @return void **/ public function accounts($Event) { $Purchase = $Event->order(); if (!$Purchase) { shopp_debug('No purchase available for account registration processing.'); return; } if (!$this->Customer->exists()) { $registration = $Purchase->registration(); if (empty($registration)) { shopp_debug('No purchase registration data available for account registration processing.'); return; } $this->Customer->copydata($registration['Customer']); $this->Billing->copydata($registration['Billing']); $this->Shipping->copydata($registration['Shipping']); // Validation already conducted during the checkout process add_filter('shopp_validate_registration', '__return_true'); // Prevent redirection to account page after registration add_filter('shopp_registration_redirect', '__return_false'); } ShoppRegistration::process(); // Update Purchase with link to created customer record if (!empty($this->Customer->id)) { $Purchase = ShoppPurchase(); if ($Purchase->id != $Event->order) { $Purchase = new ShoppPurchase($Event->order); } $Purchase->customer = $this->Customer->id; $Purchase->billing = $this->Billing->id; $Purchase->shipping = $this->Shipping->id; $Purchase->save(); } }
/** * Account registration processing. * * @since 1.3 **/ public function registration() { // Validation already conducted during the checkout process add_filter('shopp_validate_registration', '__return_true'); // Prevent redirection to account page after registration add_filter('shopp_registration_redirect', '__return_false'); ShoppRegistration::process(); }