Allow Logged-out Users to place bookings?

WordPress Event Management, Calendars & Registration Forums General Question Allow Logged-out Users to place bookings?

This topic contains 6 replies, has 3 voices, and was last updated by  Rachel Chappell 10 years, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9076

    Hi Stephen
    Is there a way to remove the 3 fields that appear when you set “Allow Logged-out Users to place bookings?” to “Yes but do not register an account”?

    The reason being is I want to force people to fill in their name and email into fields I’ve created regardless of whether they are logged in or not. Ideally I’d like the whole process to ignore whether a user is logged in or not. The reason for this is registered users can add any old junk as their name, some put in nicknames for example, but I want to pass a sensible name through the payment gateway.

    Does that make sense?
    Cheers
    Stuart

    Stuart Farish
    #9086

    Good question, I have a similar issue.

    I do not require people to login to use my website, but would like them to book tickets. I’m not sure why the name/surname/email fields appear twice?

    http://northshoremums.com.au/events/event/workshop-how-to-ride-the-parenting-rollercoaster/

    The fields below the ticket selection are the ones I have inserted. But the fields above apppear too?

    Rachel Chappell
    #9092

    Not really – they are required fields because the data they are collect are integral to the rest of the plug-in functioning well (e.g. being able to send a booking confirmation, providing tags such as %bookee_name%. I’m not entire clear on whether the problem is bookees may enter nicknames for that field, or you’re concerned about existing registered users (who do not have to provide a name) not having a name (correctly) filled in when they registered elsewhere on the site.

    If the latter you could add a check for a ‘valid’ name (but in my opinion it would be near impossible to programatically check if a given name is ‘valid’). Otherwise, if a user might be able to register elsewhere on the site, you could force them to provide a name there. In a future update it might be possible to optionally display a field to only logged out or logged-in users.

    On side note you say “pass a sensible name through the payment gateway” are your referring to the e-mails that get sent out to the bookee, or are you refering to the actual gateway (paypal/stripe)? If the latter, the name isn’t given to stripe or paypal.


    @Rachel They’re not displayed twice as such. You’ve added custom fields which perform the same purposes as the automatically added ones :). The difference between the two is that Event Organiser knows the first three fields pertain to name, surname and e-mail and will use them accordingly (e.g. in e-mail tags, in sending booking confirmation etc.).


    (Loosely related) Potential update:

    Currently the name/surname/e-mail fields are added inside the eo-booking-form.php template (and so it is possible to remove them – but doing so would ‘break’ the plug-in.) The intention behind this was to allow users to move these fields around. However, it would make much more sense to move these fields into the form customiser UI and prevent their being removed (like the current ticket picker and gateway selection). Also like the ticker picker and gateway selection, these fields will still only appear when they are required by the plug-in (in this case when the user is slogged-out).

    Stephen Harris
    #9093

    Hi Stephen
    The issue with passing a sensible name through the payment gateway is because I am attempting to add my own gateway to NetBanx. On their site they ask the user to enter their name which I want to pass from our site so the user doesn’t have to enter their details twice.

    If I remove the custom name fields I have added we won’t be capturing the persons name on the booking. As an example if I were to book a ticket while logged in the name captured at the moment would be: “webTeam Myeloma UK” as I have set my name to be
    Firstname : webTeam
    Surname : Myeloma UK

    Does that make sense??
    Stuart

    Stuart Farish
    #9102

    Ah, I see. (Just a side note – you mentioned you’re implementing a custom gateway, there’s a class EO_Payment_Gateway in the gateways folder. I recommend extending that. Documentation is rather limited, but I can provide a ‘skeleton’ plug-in for creating an additional gateway. It handles almost everything but the gateway side of things).

    Here’s perhaps one way of dealing with this. The above class I mentioned has a method (payment_form()) for adding HTML to the booking form which is only displayed when that gateway is selected (or if it is the only gateway). The intention for this is to support gateways where additional details are required (eg. Stripe requires the bookee provide a valid credit card). Any data sent in that section is ignored by the plug-in, unless the gateway itself choose to use it. (For instance PayPal Pro also requires a credit card number, but we don’t want the plug-in to save those details insecurely – in fact we don’t need to store it all).

    You could use that method to conditionally display a name field (to logged-in users).

     ....
    
        function payment_form( $element ){
                if( is_user_logged_in() ){ ?>
                        <div class="eo-booking-field-row">
                                <label for="netbanx-name"> Name </label>
                                <input type="text" id="netbanx-name" name="netbanx" />
                        </div>
                <?php }
        }
    
     ....

    When processing the booking you can use that field – or, use the stored name if not provided

        function process( $booking_id, $booking, $error, $form ){
              $stored_name = trim( eo_get_booking_meta( $booking_id, 'bookee_first_name' ) . ' ' . eo_get_booking_meta( $booking_id, 'bookee_last_name' )  );
              $name = ( empty( $_POST['netbanx'] ) ? $stored_name : sanitize_user( $_POST['netbanx'] );
    
              //Process payment
        }

    (Obviously those two methods are part of a child class which extends EO_Payment_Gateway). A simpler method would be just to require a name – even though this may result in two name fields. A future update will allow fields to be visible only to logged-in / logged-out users which will allow to get around that.

    Stephen Harris
    #9111

    Hi Stephen
    The skeleton plugin would be very helpful thanks. Currently I’ve just followed your tutorials on added a payment gateway,
    Cheers
    Stuart

    Stuart Farish
    #9116

    Thanks Stephen, I didn’t realise that name, surname and email were automatic fields! I have removed the extra ones I added in.

    Thanks for clearing it up!
    Rachel

    Rachel Chappell
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.