Support » Plugin: WPPizza » Does WP-PIZZA use wordpress users?

Viewing 15 replies - 1 through 15 (of 29 total)
  • ladober

    (@ladober)

    No it doesn’t but you can use another plugin with it:

    http://wordpress.org/plugins/pagerestrict/screenshots/

    All you need to do go to the option of the plugin and choose to restrict the order page and you are done.

    Plugin Author ollybach

    (@ollybach)

    oi, ladober, stop doing my job …:)
    just kidding. big thanks.

    actually – as mentioned the other “october 2013 readme” thread – i am officially on holiday until monday , hence my somewhat longer response times.
    i do however have a few hours to kill, so might as well catch up with things…..

    a quick note regarding wp_users.

    the plugin as such does not use any wpusers accounts for anything in particular at the moment. however, any orders (i.e the wppizza_order table) DOES catch the wp user id if it exists (i.e the user is logged in)

    reason is/was, that – at some point – I am probably going to do something with it. just as yet have not got round to it or have a definite plan as to what it is one might want to do with it (got a few ideas though)…

    so if the above mentioned plugin works for whatever it is you want to do, great. Just thought I’d mention it.

    Olly

    nostahl

    (@nostahl)

    ah great to know that the wp-pizza IS capturing the user id for now.

    would it be easy to convert the order page form to using custom fields added to wp_users and generate accounts during order taking that way?

    Plugin Author ollybach

    (@ollybach)

    dunno to be honest. haven’t thought about it.

    i would however assume it would be better to just use a “normal” register accounts plugin or some such thing to get people to register before they can order and make them login first .

    something like hiding the actual orderpage to non-logged in users by displaying a login screen .
    i believe there are quite a few plugins / options that allow you to do that…

    you can also mess with the order page template, write some conditionals etc etc.

    by default WP user management only deals with name and email though ….

    one day I will probably do something about that in conjunction with a bunch of other ideas (like special offers for repeat orders etc) but as yet , there’s no ETA on that one. sorry

    nostahl

    (@nostahl)

    the only problem with that is it makes the site look broken,

    imagine them logging in then getting to order page and filling out name and address etc. place order (mind tells them ok its got my account data saved) but then next time they order they log in and go to order page and its empty… no address info saved.

    Plugin Author ollybach

    (@ollybach)

    initially, that’s kind of a limitation of the way wp handles users (as there’s no address info etc )

    having said that, as a quick and dirty fix, you can add something like the following to the wppizza-order.php template (this wont deal with previous orders, but should display address info and the like.)

    you will have to tweak this probably depending on the fields you are using, but it should point you in the right direction…

    approx line 18, change

    global $current_user;

    to

    global $current_user,$wpdb;

    than after get_currentuserinfo(); (approx line 19 )
    add

    $customerName='';/*avoid php undefined notice*/
    $customerEmail='';/*avoid php undefined notice*/
    $customerAddress='';/*avoid php undefined notice*/
    if(is_user_logged_in() ) {
    	$res=$wpdb->get_row("SELECT customer_ini FROM ".$wpdb->prefix."wppizza_orders  WHERE wp_user_id=".$current_user->ID." ORDER BY id DESC limit 0,1");
    	$cDetails=maybe_unserialize($res->customer_ini);
    	$customerName=$cDetails['cname'];
    	$customerEmail=$cDetails['cemail'];
    	$customerAddress=$cDetails['caddress'];
    }

    you can now use these variables in your order page somewhere..

    nostahl

    (@nostahl)

    ah looks like this is on track!

    I will look into it before I start spouting off questions that may be easily identifiable.

    Thank you.

    Plugin Author ollybach

    (@ollybach)

    feel free to spout away 🙂

    nostahl

    (@nostahl)

    ok 🙂

    is wp-pizza actually saving the customer info in a table and then tying that to an order table

    or is there one table that has the order details as well as the customer info?

    Plugin Author ollybach

    (@ollybach)

    the latter

    i.e there’s one table that stores user_id, order and customer details (and some other things) – mostly serialized – on a per order basis

    maybe one day one could make a dedicated table with that stuff, but for the moment at least and as it stands i could not see any reason to create more unnecessary non-standard-wp tables although one *might* have to go down that route at some point. we’ll see. it all depends on future options and ideas…

    Plugin Author ollybach

    (@ollybach)

    and – just to preempt – the ‘customer_details’ and ‘order_details’ columns are pretty much just for display purposes in the order history page , you can’t (more accurately probably don’t want to) use these for anything else. if you want to “custom display things” – for lack of a better phrase – use the order_ini and customer_ini columns , unserialize and do what you have to do…

    just thought i’d mention it ..

    nostahl

    (@nostahl)

    instead of having a separate table holding the customer details would it make sense to add the custom fields to wp_users_meta and use the wp user functions to work them?

    Plugin Author ollybach

    (@ollybach)

    probably (sounds like a good approach to me)

    haven’t really thought about it in detail yet

    Plugin Author ollybach

    (@ollybach)

    so, finally i got round to storing the user data in the usermeta table.
    (serialized with meta_key wppizza_user_meta)

    i therefore updated the order page template accordingly to prefill the fields if the user is logged in (i.e we actually have that data)

    (prefills can be set as required in admin: wppizza->order form settings)

    if you are using a customized versions of that template, it should still work, but you might want to have a look at the changes (marked as 2.6.5.3 – erroneously instead of 2.6.6, sorry) as you might even be able to entirely not have to worry anymore about this customization if all you did was hacking that page to get the form fields to prefill themselves…

    hope that helps….:)

    Plugin Author ollybach

    (@ollybach)

    for anyone that’s following this topic:

    it just occured to me, that there’s a much,much better way to do this.

    (i.e the relevant fields would turn up in the users profile in the backend and can also – optionally – made to be added to the registration screen just by ticking a few boxes)

    will take a few days more days though to do but should be available in one of the next versions after this current 2.6.6 one

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘Does WP-PIZZA use wordpress users?’ is closed to new replies.