Limit to one appointment per month based on email, custom code tried

Support forumCategory: QuestionsLimit to one appointment per month based on email, custom code tried
radu_adrian_octavian asked 2 years ago
Hi, Please assist, I really need to make a check and prevention for users who are bad ill-intentioned and make multiple bookings to occupy the calendar slots without be really interested in the service. I've used filter ea_can_make_reservation and printing the data noticed that there it's no reference for the user data in that filter like email in order to make a check in the wordpress/db for latest appointment, if that will be less than x days, a error message will be shown trough : can_make_reservation() - $result['message'] Tried some approaches on /easy-appointments/js/frontend.js to push also the email filled by user in the input inside to the ajax request but without any success. Can you please guide me in the right direction to can achieve this kind of limit ? See attached screenshot with annotations for a clearer view.  All the best Let me know Radu      
1 Answers
Nikola Loncar Staff answered 2 years ago
Hi, can you please try this hook: ea_can_update_reservation instead of that one? Best regards, Nikola
radu_adrian_octavian replied 2 years ago

Hi,Thank you, that helped me, i appreciate it ! There i get the user data on the $data parameter!
Noticed that even i return $result[‘status’] = false; the slot it’s taken and appear as occupied in calendar, my questions it’s how can i allow the slot to be bookable even the status of the appointment it’s pending , browsing the files in the plugin but i cannot figure out yet, please offer me a hint, or do you think it will be more reliable to delete the appointment entirely by appointment ID if my condition it’s meet inside the filter ?

Have a nice day
Cheers
Radu