- Posts: 339
- Thank you received: 5
Prevent users from booking multiple events
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
4 years 7 months ago - 4 years 7 months ago #145938
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
SOLVED: Prevent users from booking multiple events was created by OTWD
Hi
I have a situation whereby I have 3 events running in 1 day
Category = Meeting 1
Events = Event1, Event2, Event3
I want users to register then login and only be allowed to book 1 of the 3 events (so they don't get greedy and pick and choose which event they want to attend therefore preventing others from booking)
I have tried a Custom sql field with:
With the aim of returning 0 or 1
I could then validate on that value.
The problem i have is the Custom sql field renders as a dropdown.
Is there any other way of doing this?
Thanks
I have a situation whereby I have 3 events running in 1 day
Category = Meeting 1
Events = Event1, Event2, Event3
I want users to register then login and only be allowed to book 1 of the 3 events (so they don't get greedy and pick and choose which event they want to attend therefore preventing others from booking)
I have tried a Custom sql field with:
Code:
S ELECT C OUNT(*) F ROM `#_eb_registrants` W HERE`event_id` = 2027 A ND `user_id` = [USER_ID]
I could then validate on that value.
The problem i have is the Custom sql field renders as a dropdown.
Is there any other way of doing this?
Thanks
Success consists of going from failure to failure without loss of enthusiasm.
Last edit: 4 years 7 months ago by OTWD.
Please Log in or Create an account to join the conversation.
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 339
- Thank you received: 5
4 years 7 months ago - 4 years 7 months ago #145941
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
Replied by OTWD on topic Prevent users from booking multiple events
Hi,
I am trying to use the validator.php as per eventbookingdoc.joomservices.com/basic-s...eld-data-server-side to prevent users from booking more than 1 event. see attached file (I cant post the code into the forum due to Sucuri blocking )
I have created a Custom field in EB called "check email" for testing purposes.
If the user enters the same email that they used to book a previous event (id = 2027)it should return False.
I am using the code in the google doc - it doesnt throw any errors but it still allows the booking to go through.
The user has already booked onto event with id 2027 so it should return false.
I can confirm I am loading my_custom_rule into the Server Validation Rules field
Any pointers please?
docs.google.com/document/d/15sDRNK9yqXYs...yg8/edit?usp=sharing
I am trying to use the validator.php as per eventbookingdoc.joomservices.com/basic-s...eld-data-server-side to prevent users from booking more than 1 event. see attached file (I cant post the code into the forum due to Sucuri blocking )
I have created a Custom field in EB called "check email" for testing purposes.
If the user enters the same email that they used to book a previous event (id = 2027)it should return False.
I am using the code in the google doc - it doesnt throw any errors but it still allows the booking to go through.
The user has already booked onto event with id 2027 so it should return false.
I can confirm I am loading my_custom_rule into the Server Validation Rules field
Any pointers please?
docs.google.com/document/d/15sDRNK9yqXYs...yg8/edit?usp=sharing
Success consists of going from failure to failure without loss of enthusiasm.
Last edit: 4 years 7 months ago by OTWD.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
4 years 7 months ago #145956
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Prevent users from booking multiple events
Could you please use this updated validator.php file which I upload here? I don't see anything wrong from the original code except the where clause needs to be changed abit
The following user(s) said Thank You: OTWD
Please Log in or Create an account to join the conversation.
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 339
- Thank you received: 5
4 years 7 months ago #145963
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
Replied by OTWD on topic Prevent users from booking multiple events
Thanks Tuan,
I needed to validate against the select count so if it was 0 return false.
I find the j! sql queries tricky so my solution now looks like this.
To save having to enter loads of event ids i did a join on the category field which means if an event has already been booked in that category then disallow a second booking.
I am using a Custom field > text with a client side validation of validate[equals
I needed to validate against the select count so if it was 0 return false.
I find the j! sql queries tricky so my solution now looks like this.
To save having to enter loads of event ids i did a join on the category field which means if an event has already been booked in that category then disallow a second booking.
I am using a Custom field > text with a client side validation of validate[equals
Success consists of going from failure to failure without loss of enthusiasm.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
4 years 7 months ago #145966
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Prevent users from booking multiple events
Thanks. Please just leave the code there. If someone needs it, they can use it (or at least uses it as base code and customize it further to meet their own need)
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2026 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.