Events Made Easy › Forums › Bug fixed or feature request implemented › RSVP to event after start does not work
- This topic has 5 replies, 2 voices, and was last updated 5 years, 8 months ago by Franky.
-
AuthorPosts
-
Wed 19 Sep 2018 at 13:48 #58429AnonymousInactive
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)) {
Wed 19 Sep 2018 at 13:56 #58430FrankyKeymasterThanks for this. I’ll take a closer look at this logic this evening.
Wed 19 Sep 2018 at 19:56 #58445FrankyKeymasterI think the “&&” is not the correct fix, but this should fix it:
Tue 12 Mar 2019 at 15:41 #59748AnonymousInactiveHi, 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.
Tue 12 Mar 2019 at 15:52 #59749FrankyKeymasterIndeed, 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 …)
Tue 12 Mar 2019 at 21:45 #59752FrankyKeymasterSome “>” things were still wrong in the last if-statement, but this is the final fix:
https://plugins.trac.wordpress.org/changeset/2049331/ -
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.