Support

Home Forums Event Espresso Premium csv import registration start and end times

csv import registration start and end times

Posted: December 14, 2013 at 2:28 pm


Mark Cockfield

December 14, 2013 at 2:28 pm

The csv file does not have columns for registration_startT and registration_endT so they default to NULL. Then in the Event Overview list the start time is shown as 4:00PM. However, it would appear that the 4:00PM start time is a spurious result of <?php echo date( get_option('time_format'), strtotime( $registration_startT )); ?> as I was able to register before 4PM on the start date.

Seems like the database should have reasonable default values or the import file should provide for those columns.

As an aside:

In other posts regarding issues with the import it was stated that all of the columns in the csv file needed to be populated. This didn’t make sense to me as the database columns allow NULLs and I could see nothing in csv_import.php that would force such a requirement; but, in fact was the behavior if the csv file was TAB delimited.

So with a bit of fiddling I did verify that as long as the csv file is comma delimited and I also specify “Quoted fields as text” in the LibreOffice calc program csv import, I was able to only populate the columns actually required, those populated by manually creating a basic event. Specifically, I did not see the need to bloat the database with an email message in every row.


Josh

  • Support Staff

December 16, 2013 at 1:51 pm

Hi Mark,

Thanks for taking time to leave this valuable feedback. I checked on this and it turns out that the event’s start time is the result of:

<?php echo date( get_option('time_format'), strtotime( $start_time )); ?>

and the event’s registration start time is the result of:

<?php echo event_date_display( $registration_start, get_option('date_format')); ?> @ <?php echo date( get_option('time_format'), strtotime( $registration_startT )); ?>

It looks like if the event is imported it will default to midnight for the registration start end times.

I should clarify on the point about populating all the fields for the import. You can import the optional columns as blank in cases where there is a default (like the email), but the important thing is there is still a corresponding comma there. For example the email column in the CSV would show something like ,,, and you’d want to be sure to set the send_mail value to N (send_mail set the option to use a custom email message).

What was happening in those other threads was folks were deleting the commas where ever they didn’t want to include a specific column.


Mark Cockfield

December 17, 2013 at 4:14 pm

Hi Josh,

Thanks for the clarification on the optional fields.

The registration start and end time columns in the database have a default value of NULL and therefore imported events have registration start and end times of NULLs.

I ran a quick test on my server (PHP 5.3.3, MySQL 5.1.61, and Apache 2.2.15) to verify. I created a file date.php with the following:

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php
echo "Testing a NULL date: " . date('g:i a', strtotime( NULL ));
?>

And when I retrieve the file in a browser it displays:

Testing a NULL date: 4:00 pm

which is the same time that appears on the “Event Overview” page…yet as I mentioned I was able to register for the event before 4:00 pm.

So the point I was trying to make is that the behavior may be that registration “opens” at midnight but the event overview shows an incorrect time as a result of the NULL being passed into the strtotime function.

Mark


Mark Cockfield

December 17, 2013 at 4:17 pm

On another note: How do you get your code snippets to display the way they do? The instructions do not yield such results….


Josh

  • Support Staff

December 18, 2013 at 7:53 am

This might be a case where your server settings are different than my server’s settings. When I run code you posted, it displays 12:00AM. At any rate, we are working on converting all the date time records to use unix time stamps to improve on this.

When I post code onto the forums I first copy/paste the code into the editor, then highlight and then click the link to the language that matches.


Mark Cockfield

December 18, 2013 at 12:03 pm

Hey Josh,

Well, I’ve verified that I have the correct timezone set in my php.ini and I see no other settings that would affect behavior; I did verify that <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>strtotime( NULL ); is returning bool(false) so I suppose the behavior of passing that into a date function is expected to be unpredictable.

Regarding snippet posting, that is exactly what I did…?

The support post ‘csv import registration start and end times’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso