WordPress.org

Ready to get started?Download WordPress

Forums

WPPizza
[resolved] Does WP-PIZZA use wordpress users? (30 posts)

  1. nostahl
    Member
    Posted 10 months ago #

    I was trying to figure out if the order screen that asks for info is suppose to be creating a wordpress user account or no?

    http://wordpress.org/plugins/wppizza/

  2. ladober
    Member
    Posted 10 months ago #

    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.

  3. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    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

  4. nostahl
    Member
    Posted 10 months ago #

    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?

  5. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    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

  6. nostahl
    Member
    Posted 10 months ago #

    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.

  7. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    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..

  8. nostahl
    Member
    Posted 10 months ago #

    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.

  9. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    feel free to spout away :)

  10. nostahl
    Member
    Posted 10 months ago #

    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?

  11. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    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...

  12. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    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 ..

  13. nostahl
    Member
    Posted 10 months ago #

    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?

  14. ollybach
    Member
    Plugin Author

    Posted 10 months ago #

    probably (sounds like a good approach to me)

    haven't really thought about it in detail yet

  15. ollybach
    Member
    Plugin Author

    Posted 9 months ago #

    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....:)

  16. ollybach
    Member
    Plugin Author

    Posted 9 months ago #

    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

  17. ladober
    Member
    Posted 9 months ago #

    Olive........ you are legend

  18. ladober
    Member
    Posted 9 months ago #

    Sorry I meant Oliver :)

  19. ollybach
    Member
    Plugin Author

    Posted 9 months ago #

    right then

    2.7 now allows to add the order form fields to be prefilled as well as adding them when registering

    any enabled fields will also be view/edit-able in the profile page

    and added to the user meta data

  20. nostahl
    Member
    Posted 9 months ago #

    one step closer to showing users their own order history I like it! :)

  21. ollybach
    Member
    Plugin Author

    Posted 9 months ago #

    yeah, that's kind of where i'm - slowly admittedly - trying to get to (and a few other things..as always)

  22. nostahl
    Member
    Posted 9 months ago #

    That and editing a product already added to the shopping cart will be the best features at this time I think :)

  23. ladober
    Member
    Posted 8 months ago #

    I tried the plugin on multisite on my localhost it works perfectly but it isn't storing the user data like the normal site.
    Any solution for this?
    Thanks

  24. ollybach
    Member
    Plugin Author

    Posted 8 months ago #

    you really have to be more specific. saying: "it isn't storing the user data like the normal site." really isn't very helpful ......

  25. ollybach
    Member
    Plugin Author

    Posted 8 months ago #

    also, please start a new topic, this has long since been merked as resolved and kind of has not much to do with the original topic anymore

  26. ladober
    Member
    Posted 8 months ago #

    Really Sorry for my broken English. I will start new topic if needed.
    Thanks

  27. ollybach
    Member
    Plugin Author

    Posted 8 months ago #

    >Really Sorry for my broken English.
    your english is fine. i just need you to be more specific

    > I will start new topic if needed.
    probably a good idea (i.e yes, please do )

  28. aljo1985
    Member
    Posted 3 months ago #

    I have to say, I love this plugin and I been playing with it for a little now... I was also wondering about putting a user system on it also.. I found http://wordpress.org/plugins/profile-builder/ ... Started to look around in the source code. Been playing around, currently in the process of getting the front end user system to work with wppizza so people can store their address and such, without going into WordPress admin. If you like when I have finished, I can post what I made from it, and you can also use this as an front facing user base. Because that is what it will be doing very soon :D.. I am looking for a front facing login system that works with wppizza so users can log in and update their profile information without even knowing there is a wordpress admin panel.. Well that will shut off complete soon as the site is finished :)

  29. aljo1985
    Member
    Posted 3 months ago #

    Okay for this I am going to show you how to make wppizza use profile builders signup features to record the information you want in the additional information section of your profile.
    when members register.. While giving you a full front facing user system also, so members will never see the WP admin panel.

    front-end/wppb.register.php
    Search for "First Name", "Last Name" and all the form field names on registration that you have activated in the admin panel of profile builder
    They start at around line 1047
    example : <label for="nickname">'. __('Street Name', 'profilebuilder') .$errorMark.'</label>
    Replace these with your desired input fields.. ** Important do not change the email, user and pass fields, just change the ones you can. I changed these..
    So you can search and replace these with your desired names.. First Name, Last Name, Nickname, Website and AIM
    I changed them 2, Name, House Number, Street Name, Postcode, Telephone. I disabled any others in the admin panel for profile builder so It shown only the fields I wanted to display.
    This enables members to register their address on signup.
    In the same file search for
    wppb_signup_user( $userdata['user_login'], $userdata['user_email'], $meta );

    Just above this you will see
    $meta = array(
    'user_pass' => base64_encode($userdata['user_pass']),
    'first_name' => $userdata['first_name'],
    'last_name' => $userdata['last_name'],
    'nickname' => $userdata['nickname'],
    'user_url' => $userdata['user_url'],
    'aim' => $userdata['aim'],
    'yim' => $userdata['yim'],
    'jabber' => $userdata['jabber'],
    'description' => $userdata['description'],
    'role' => $userdata['role']
    );
    What you need to do is go into your database in wp_usermeta, and look at the meta_key row for the wppizza inputs.
    Store these names, you will need them later cause we are going to be inserting the details of the registration into here, which enables us to capture the address and everything else.
    Mine looked like this,
    wppizza_cname
    wppizza_caddress
    wppizza_ctel
    wppizza_ccomments
    wppizza_ccustom1

    Okay now determine which of them rows leads to the wppizza additional information, in your profile on WP.
    The code above would then be changed using the meta_key wppizza fields like so

    $meta = array(
    'user_pass' => base64_encode($userdata['user_pass']),
    // Edited. //
    'wppizza_cname' => $userdata['first_name'],
    'wppizza_caddress' => $userdata['last_name'],
    'wppizza_ctel' => $userdata['nickname'],
    'wppizza_ccomments' => $userdata['user_url'],
    'wppizza_ccustom1' => $userdata['aim'],
    // End edit. //
    'yim' => $userdata['yim'],
    'jabber' => $userdata['jabber'],
    'description' => $userdata['description'],
    'role' => $userdata['role']
    );
    I put my meta_key rows in here instead.
    Now we need to open functions/email.confirmation.php
    Search for "update_user_meta( $user_id, 'description', $meta['description'] );"
    It is at around line 151, what you need to do is copy and paste this underneath the search.
    if( !empty($meta['wppizza_cname'] ) )
    update_user_meta( $user_id, 'wppizza_cname', $meta['wppizza_cname'] );
    if( !empty($meta['wppizza_caddress'] ) )
    update_user_meta( $user_id, 'wppizza_caddress', $meta['wppizza_caddress'] );
    if( !empty($meta['wppizza_ctel'] ) )
    update_user_meta( $user_id, 'wppizza_ctel', $meta['wppizza_ctel'] );
    if( !empty($meta['wppizza_ccomments'] ) )
    update_user_meta( $user_id, 'wppizza_ccomments', $meta['wppizza_ccomments'] );
    if( !empty($meta['wppizza_ccustom1'] ) )
    update_user_meta( $user_id, 'wppizza_ccustom1', $meta['wppizza_ccustom1'] );

    Replace the wppizza_ with the same wppizza_ rows you replaced above

    Open front-end/wppb.edit.profile.php
    Like we did with the front-end/wppb.register.php file, search again for the Last Name, First Name input fields and change them to the same ones you did on register.
    Once we have replaced all those we then need to do a search for wp_update_user and update_user_meta they will look something like this.
    "wp_update_user( array( 'ID' => $current_user->ID, 'last_name' => esc_attr( $_POST['last_name'] )));"
    What we do here is replace the last_name, first_name and so on with your wppizza_ rows. when you are searching for update_user_meta
    When you are searching for wp_update_user, replace the whole line.. "wp_update_user( array( 'ID' => $current_user->ID, 'last_name' => esc_attr( $_POST['last_name'] )));"

    with this

    "update_user_meta( $current_user->ID, 'wppizza_caddress', esc_attr( $_POST['last_name'] ) );"
    while also changing the wppizza_caddress with your own rows!

    Remember do not replace email, username and password. These are needed in the registration process, destroy these and you have a massive problem!

    Now I have a perfect registration page and user system. I capture the details I want in the tables I want on registration and allow users to edit their details without having to go into wordpress admin.
    I know its very sloppy, but I only did this to basically do the job. Maybe someone can turn this into something better :)
    I'm a noob to wordpress, so forgive my bad details.
    Hope you find this useful or maybe even integrate them both for the perfect user panel :).

    Here is a table of the information I replaced
    Name - first_name - wppizza_cname
    House Number - last_name - wppizza_caddress
    Street Name nickname - wppizza_ctel
    Postcode - user_url - wppizza_ccomments
    Telephone - aim - wppizza_ccustom1

  30. ollybach
    Member
    Plugin Author

    Posted 2 months ago #

    just saw this.....

    anyway, you could make your life a hell of a lot easier by just using the theme my login plugin instead as it will automatically use/recognise all the enabled / added fields....(you were replying to a 6 months old thread btw)

    just saying....

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.