Hey izne,
I had run into a similar problem recently while developing a WP site with Shopp. I needed users to be registered prior to setting up payments, as we are integrating the site with Authorize.Net’s Customer Information Management(CIM) system.
Everytime I tried using the Shopp Customer Register plugin, it would say that I had entered an incorrect password.
After scouring the internet with no luck besides finding this post, I decided to take a look at the code.
Line 233-237:
else
{
$shopp_customer->password = wp_hash_password($data['password']);
}
$shopp_customer->save();
Change $data[‘password’] to $customer_data[‘password’] and voila, it works!
-Steve
Thread Starter
izne
(@izne)
Hey Steve,
THANKS!
I totally missed that variable name was incorrect.
I owe you a beer 🙂
Im sorry about this, i feel stupid, i have fixed this in version 0.4.5.
Thread Starter
izne
(@izne)
Hey maca134,
We have a customer-info field for VAT number in our Shopp checkout. <?php shopp('checkout','customer-info'); ?>
I need to make small modification now to have this field also in the registration from from your plugin. Could you give me an advice on how is the best way to make that field recorded when user is created?
Thread Starter
izne
(@izne)
Meanwhile, I figured this out myself and here is my “rude” approach.
First I created the field in views/form.php like this:
<p>
<label for="sreg-vat">BTW</label>
<input type="text" name="billing[vat]" id="sreg-vat" value="<?php echo (isset($_POST['billing']['vat'])) ? $_POST['billing']['vat'] : ''; ?>" />
</p>
Added a small function that writes the VAT…
private function addVAT($email, $vat = ''){
/**
* shoppregcust::addVAT()
* by izne <me@izne.info>
*
* @param mixed $email
* @param mixed $name
* @return
*/
global $wpdb;
$id = $wpdb->get_var("SELECT id FROM wp_shopp_customer WHERE email = '".$email."'");
if($id){
$varr = array("vat" => "$vat");
$a = serialize($varr);
$sql = "
UPDATE wp_shopp_customer SET
<code>info</code> = '$a'
WHERE <code>id</code> = $id";
$wpdb->query($sql);
return 1;
}
return 0;
}
… and used it after $shopp_customer->save();
like this:
$this->addVAT($customer_data['email'], $_POST['billing']['vat']);
.
So far it looks like working for me.