• Resolved dryan1144

    (@dryan1144)


    We have multiple events, and a user can buy a max of 1 ticket per event.

    We want to limit a user to only 1 event.

    Is there a way to accomplish this?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    hi,

    yes, when adding or updating events under section Bookings/Registration you can use ticket min/max required per booking

    Thread Starter dryan1144

    (@dryan1144)

    We already have min max rules to limit a user to one ticket per event. What we are trying to do is limit a user to only one Event.

    As in if they have a current booking (no matter which event it is) they can’t book another event.

    Is this possible?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    I see, try Events > Settings > Bookings > General Options > Allow double bookings =No

    Thread Starter dryan1144

    (@dryan1144)

    Again that setting would apply to booking the same event twice.

    We want to prevent a user from having more than one event booked.

    Sorry if I’m not being clear, I didn’t think it would be this complicated.

    Sorry, there’s no option to do this out-of-the-box. You could probably achieve it with custom coding that either checks a cookie recording a previous purchase or restricts bookings based on a unique ID like an email address.

    Another alternative would be to restrict bookings by user accounts.

    Thread Starter dryan1144

    (@dryan1144)

    All bookings will be made by logged in users, I should have specified.

    How would I go about checking to see if a user has an active booking?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    maybe you can hook into em_booking_validate filter and then create a loop checking the users active bookings.

    e.g.

    function my_em_mods($result,$EM_Booking){
     //$result is boolean
    
     return $result;
    }
    add_filter('em_booking_validate','my_em_mods',10,2);

    Hi
    If you do find a solution to this, or if there is any chance of this becoming a standard feature, this is something we have a need for.

    We allow our members to book 2 future events at a time, and occasionally someone will book more.

    It would be great to have a limit to the number of future events that can be booked at any time by one registered user.

    Thanks

    I tested Angelo’s suggestion and it works perfectly

    I my opinion this is THE solution.

    The filter allows to apply whatever rule to allow/forbid a booking.

    You can’t put all these rules in the core code … Imagine the configuration pages ??

    I tested Angelo’s suggestion and it works perfectly

    I my opinion this is THE solution.

    The filter allows to apply whatever rule to allow/forbid a booking.

    You can’t put all these rules in the core code … Imagine the configuration pages ??

    Thread Starter dryan1144

    (@dryan1144)

    Good to hear @franceimage.

    How/where did you implement it?

    Consider this example: user tom is being banned from booking …

    You can put following code in your theme functions.php (if you are lazy) or better create a plugin with all your rules

    function my_em_mods($result,$EM_Booking){
         global $current_user;
        get_currentuserinfo();
    
            if ($current_user->user_login == 'tom' ) {
                  $EM_Booking-> errors = array_merge($EM_Booking-> errors, array ('tom cannot book'));
                  $result = false ;
           }
            return $result;
    }
    add_filter( 'em_booking_validate', 'my_em_mods' ,10,2);

    For your example, you will have to use a meta for your users that will hold the current booking info

    Hello,

    I am facing the same issue with my website.

    I would like to limit the total number of bookings a user can make.

    I’ve tried using the above codes but still can’t get it to work by any chance.

    Any help appreciated.

    Thanks.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    you need to modify the code above e.g. $current_user->user_login == 'tom'

    Yes, I’ve already tried to modify it.

    1st of all, just to test… I changed the user from ‘tom’ to ‘admin’ i.e my username, but it still allows me to book tickets.

    secondly, I don’t really know what modifications to make for user booking restriction.

    This is really urgent, Can I add you on skype or something ?

    Thanks.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Limit a user to one booking, globally’ is closed to new replies.