Events Made Easy Forums Bug fixed or feature request implemented RSVP to event after start does not work

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #58429
    Anonymous
    Inactive

    Hi,

    I noticed that RSVP after an event starts does not work anymore (even if the setting is set to allow it until hours before the end of the event).

    I found this on line 124 and 125 in eme_rsvp.php:

    
    if($event_rsvp_end->minusDays(intval($tmp_event['rsvp_number_days']))->minusHours(intval($tmp_event['rsvp_number_hours']))->lessThan($eme_date_obj_now) ||
    $event_rsvp_startdatetime->lessOrEqualTo($eme_date_obj_now)) {
    

    Where just one has to be true to result in the “eme_rsvp_no_longer_allowed_string” error. And $event_rsvp_startdatetime->lessOrEqualTo($eme_date_obj_now)) will always be true after the event starts.

    I changed it to the following with success:

    
    if($event_rsvp_end->minusDays(intval($tmp_event['rsvp_number_days']))->minusHours(intval($tmp_event['rsvp_number_hours']))->lessThan($eme_date_obj_now) &&
    $event_rsvp_startdatetime->lessOrEqualTo($eme_date_obj_now)) {
    
    #58430
    Franky
    Keymaster

    Thanks for this. I’ll take a closer look at this logic this evening.

    #58445
    Franky
    Keymaster

    I think the “&&” is not the correct fix, but this should fix it:

    http://plugins.trac.wordpress.org/changeset/1943831

    #59748
    Anonymous
    Inactive

    Hi, I’m sorry for the late reply. The site using this plugin only sees this problem for a couple of weeks every half year.

    The problem is still there.

    
    124 if ( (intval($tmp_event['rsvp_number_days'])>0 || intval($tmp_event['rsvp_number_hours'])>0) &&
    125 $event_rsvp_end->minusDays(intval($tmp_event['rsvp_number_days']))->minusHours(intval($tmp_event['rsvp_number_hours']))->lessThan($eme_date_obj_now) ) {
    126 // in case of multibooking: don't show anything, but in case of single booking: show the 'no longer allowed' message
    127 $no_longer_allowed=get_option('eme_rsvp_no_longer_allowed_string');
    128 if (!$is_multibooking)
    129   return "<div class='eme-rsvp-message-error'>".$no_longer_allowed."</div>";
    130 else
    131   continue;
    132 } elseif ($event_rsvp_startdatetime->lessOrEqualTo($eme_date_obj_now)) {
    133   // in case of multibooking: don't show anything, but in case of single booking: show the 'no longer allowed' message
    134   $no_longer_allowed=get_option('eme_rsvp_no_longer_allowed_string');
    

    Here you check if fields are set (line 124) and if the period has runned out (line 125), if so give error message.
    If not the elseif on line 132 is evaluated, which will return the error as the event has allredy started.

    So the error message will be shown for any value of rsvp_number_days and rsvp_number_hours.

    #59749
    Franky
    Keymaster

    Indeed, you’re correct. The first if should be split into 2 too. This should fix it:

    	   if ( (intval($tmp_event['event_properties']['rsvp_start_number_days'])>0 || intval($tmp_event['event_properties']['rsvp_start_number_hours'])>0)) {
    	        if ($event_rsvp_start->minusDays(intval($tmp_event['event_properties']['rsvp_start_number_days']))->minusHours(intval($tmp_event['event_properties']['rsvp_start_number_hours']))->greaterThan($eme_date_obj_now)) {
    				// in case of multibooking: don't show anything, but in case of single booking: show the 'no longer allowed' message
    				$not_yet_allowed=get_option('eme_rsvp_not_yet_allowed_string');
    				if (!$is_multibooking) 
    					return "<div class='eme-rsvp-message-error'>".$not_yet_allowed."</div>";
    				else
    					continue;
    			}
    	   }
    	   if ( (intval($tmp_event['rsvp_number_days'])>0 || intval($tmp_event['rsvp_number_hours'])>0)) {
    			if ($event_rsvp_end->minusDays(intval($tmp_event['rsvp_number_days']))->minusHours(intval($tmp_event['rsvp_number_hours']))->lessThan($eme_date_obj_now) ) {
    				// in case of multibooking: don't show anything, but in case of single booking: show the 'no longer allowed' message
    				$no_longer_allowed=get_option('eme_rsvp_no_longer_allowed_string');
    				if (!$is_multibooking) 
    					return "<div class='eme-rsvp-message-error'>".$no_longer_allowed."</div>";
    				else
    					continue;
    			}
    	   }
    	   if ($event_rsvp_startdatetime->lessOrEqualTo($eme_date_obj_now) &&
    	       intval($tmp_event['event_properties']['rsvp_start_number_days'])==0 &&
    		   intval($tmp_event['event_properties']['rsvp_start_number_hours'])>0 &&
    		   intval($tmp_event['rsvp_number_days'])>0 &&
    		   intval($tmp_event['rsvp_number_hours'])>0)
    		   {
    		   // in case of multibooking: don't show anything, but in case of single booking: show the 'no longer allowed' message
    		   $no_longer_allowed=get_option('eme_rsvp_no_longer_allowed_string');
    		   if (!$is_multibooking) 
    			   return "<div class='eme-rsvp-message-error'>".$no_longer_allowed."</div>";
    		   else
    			   continue;
    	   }
    

    (excuse the indentation, it is copy/paste at work …)

    #59752
    Franky
    Keymaster

    Some “>” things were still wrong in the last if-statement, but this is the final fix:
    https://plugins.trac.wordpress.org/changeset/2049331/

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.
Scroll to Top