• Resolved izne

    (@izne)


    Hello,

    I have installed this handy plugin to Shopp 1.1.4 and modified the version check in the source, to allow it to run in our installation. It works, except that the user password is wrong, if the user is created thru this plugin. Then, if we go in “Shopp Customers” in the backend and change the password (to the same) – it works. Somehow the generation of the password is not quite compatible with Shopp 1.1.4 and I need some advice on how should I approach this problem and make this work for me. I have checked the source and found out it uses the same method as Shopp normally does its users:
    $shopp_customer->password = wp_hash_password($data[‘password’]), where $shopp_customer is Shopp’s “new Customer()”.

    Any idea is helpful.
    Regards.

    http://wordpress.org/extend/plugins/shopp-customer-register/

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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 🙂

    Plugin Author Matthew McConnell

    (@maca134)

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Shopp Customer Register] password incorrect’ is closed to new replies.