• sharmaabhi

    (@sharmaabhi)


    I want to restrict user from submitting event on same day. How can I do that? There is no setting for this. So I’m guessing I have to some custom coding. But I don’t know where to start. Can you guide me?

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

    (@angelo_nwl)

    Thread Starter sharmaabhi

    (@sharmaabhi)

    Sorry, but I don’t think you understand my question.
    I meant to say if one user had already booked an event for a particular day then another user should not be able to book an event for the same day.

    caimin_nwl

    (@caimin_nwl)

    There are a few of ways you could do this but, like you say, they would all involve quite a lot of custom that we’re not really able to help with here.

    That said, one way to do it would be to create a custom database look up that checks whether a ticket has been sold for that day and have it run before the booking form with an if/else statement.

    The template you’d need to customize is this one:
    /events-manager/templates/placeholders/bookingform.php

    This tutorial explains how to create custom templates that are upgrade-safe:
    https://wp-events-plugin.com/documentation/using-template-files/

    Hope that helps.

    Thread Starter sharmaabhi

    (@sharmaabhi)

    @caimin_nwl I’m talking about event submission itself not booking of event.
    Again sorry, this is embarrassing.
    When user try to choose date for event submission I want to show dates(which have event associated with) on datepicker disabled.

    Thread Starter sharmaabhi

    (@sharmaabhi)

    Also, Can you tell me if it is possible to show weekly view of normal calendar on mobile ?
    Thanks

    Thread Starter sharmaabhi

    (@sharmaabhi)

    Hi @caimin_nwl
    Please help me with this. I really need to implement it.
    Thanks

    caimin_nwl

    (@caimin_nwl)

    When user try to choose date for event submission I want to show dates(which have event associated with) on datepicker disabled.

    Ok, sorry got it now.

    You’d need write a custom database query to find out which days have events and apply that to the datepicker using something along these liness:

    https://davidwalsh.name/jquery-datepicker-disable-days

    Can you tell me if it is possible to show weekly view of normal calendar on mobile ?

    Can you tell me a bit more about what you want to do? Do you want the calendar to display a certain way only on mobile, for example?

    Thread Starter sharmaabhi

    (@sharmaabhi)

    Thanks for the reply
    I tried what you suggest. I fetched the dates of events and set in a hidden field and used that array of dates in javascript.
    But for some reason, my datepicker is not being triggered. Below is the code that I implemented :-

    jQuery(document).ready(function(){
    	function disableSpecificDates(date) {
    		var disableDates = JSON.parse(jQuery('.em-date-start').attr('data-event-dates'));
    		var m = date.getMonth();
    		var d = date.getDate();
    		var y = date.getFullYear();
    
    		// First convert the date in to the mm-dd-yyyy format 
    		// Take note that we will increment the month count by 1 
    		var currentdate = y + '-' + (m + 1) + '-' + d ;
    		console.log(currentdate);
    		console.log(disableDates);
    		// We will now check if the date belongs to disableddates array 
    		for (var i = 0; i < disableDates.length; i++) {
    
    			// Now check if the current date is in disabled dates array. 
    			if (jQuery.inArray(currentdate, disableDates) != -1 ) {
    				return [false];
    			}
    		}
    
    	}
    	
    	jQuery('.em-date-start').datepicker({
    		beforeShowDay: disableSpecificDates
    	});	
    });

    Please tell me what I’m doing wrong ?
    Thanks

    Thread Starter sharmaabhi

    (@sharmaabhi)

    Can you tell me a bit more about what you want to do? Do you want the calendar to display a certain way only on mobile, for example?

    I’m showing full normal calendar on desktop. I wonder if I can show calendar week wise on mobile screen.
    Like only two column. One column shows day or date and another column shows events name for the respective day of the week. Because if I make full monthly calendar
    small on mobile screen, user won’t be able to see events name.

    • This reply was modified 7 years ago by sharmaabhi.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Prevent event submission on same datetime’ is closed to new replies.