Import does not respect the Wordpress Timezone

Import does not respect the WP timezone setting with respect to generating the EOT Date fields and instead uses UTC. This is problematic on many levels. Primarily, there is no situation in which an import should not respect the timezone that has been set by the server (can you come up with one)? Secondly, it is next to impossible to troubleshoot. Finally, fixing myriad EOT entries on a bulk import is extremely challenging, in fact I can’t think of a way to do it without basically writing a custom script for the purpose. It is incredibly laborious. Please fix this so the time function on import respects the wordpress timezone, or adjust the time before converting it to UTC.

Thanks for letting me know. I’ll take a look at it.

:slight_smile:

Okay, after studying the code and the way WordPress uses the timezone, I came up with something for you.

In the file s2member-pro/src/includes/classes/imports-simple-in.inc.php search for these lines:

				if(isset($file) && is_resource($file)) // Only process if we have a resource.
				{

And add after it:

					//!!! Set default timezone
					$wp_timezone = wp_timezone_string();
					if (!empty($wp_timezone)) {
						date_default_timezone_set($wp_timezone);
					}

Then use the Simple User Exporter to get a CSV of your users, edit their Auto EOT column, and reimport with the Simple User Importer. This won’t work with the Advanced one, has to be the Simple one.

I tested before the customization and after, with different timezones in my WP settings, and it worked.

I hope that helps you get the behaviour you prefer! :slight_smile:

1 Like

Thanks!