Skip Navigation

[Resuelto] Cred notifications using wrong timezone

This support ticket is created hace 6 años, 6 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 11 respuestas, has 2 mensajes.

Last updated by Luo Yang hace 6 años, 6 meses.

Assisted by: Luo Yang.

Autor
Mensajes
#577769

I have a Cred form that submits events. The events all have start and finish times (custom fields). They generally work great. But, when I set up a notification (upon submittal), things get screwy. The start times show up 7 hours early (we're -7 UTC) in the emails. They're fine on the actual post and in the backend, but in the emails, they're all wrong.

Date/Time: Default Start: October 12, 2017 4:00 pm
Simplified Start: 1507849200
Raw Start: October 12, 2017 4:00 pm
Timezone Time: October 12, 2017 4:00 pm PDT
Another One: 10/12/2017 16:00 PDT

Date Submitted: October 10, 2017 2:24 pm

The time for those first 5 lines should have been 11pm, not 4pm. The timezone is correct, as you can see from the PDT on the fourth line. The post date is correct, as you can see from the bottom.
The unix timestamp shows that it thinks I'm submitting for 11pm UTC, when all of my settings (WP, Apache, PHP) are set for PDT.

Any ideas?

#577792

Dear Sean,

I need detail steps to duplicate same problem:
1) How do you setup the fields start and finish times? are they custom date fields created with Types plugin?
2) How do you display the start time in the email notification? with Types shortcodes?
can you take some screenshots for them? thanks

#577960
Screen Shot 2017-10-11 at 9.48.20 AM.png

1) Yes, they are custom date fields created with Types. See attached screenshot.
2) I tried a variety of things.

Date/Time: Default Start: [types field='starting-daytime-10' style='text' format='F j, Y g:i a'][/types]
Simplified Start: [types field='starting-daytime-10' output='raw'][/types]
Timezone Time: [types field='starting-daytime-10' style='text' format='F j, Y g:i a T'][/types]
Another One: [types field='starting-daytime-10' style='text' format='m/d/Y G:i T'][/types]

Date Submitted: [wpv-post-date format="F j, Y g:i a"]
#578078
timezone2.JPG
timezone1.JPG

Here are detail steps I tried, it works fine in my localhost.

1) Create a custom date field "starting-daytime-10"

2) Create a CRED form with above date field
with an email notification setting, the code of notification body:

Date/Time: Default Start: [types field='starting-daytime-10' style='text' format='F j, Y g:i a'][/types]
Simplified Start: [types field='starting-daytime-10' output='raw'][/types]
Timezone Time: [types field='starting-daytime-10' style='text' format='F j, Y g:i a T'][/types]
Another One: [types field='starting-daytime-10' style='text' format='m/d/Y G:i T'][/types]
 
Date Submitted: [wpv-post-date format="F j, Y g:i a"]

3) Test above CRED form in front-end, see screenshot timezone1.JPG
after submit the CRED form, I see email notification body output screenshot timezone2.jpg

There isn't similar problem you mentioned above, so it might be a compatibility problem or server problem in your website, please check these:
1) You are using the latest version of CRED + Types plugins
2) deactivate other plugins and switch to wordpress default theme, and test again
3) Try the same settings in another webserver.

#578309

1) I am using the latest plugins (non-beta), as you can tell from the debug information I provided.

To confirm that this actually works for you, please set your server to something besides the UTC timezone. It's not really a valid comparison if everything is configured to the one timezone that most servers treat as the default.

I will continue to investigate my server settings in the meantime.

It looks like things work great on my server with php5, but fail on the server with php7. Otherwise they're almost identical (and are set to the correct timezones).

#578397

I am using PHP 7.1 in my localhost too, as you can see it works fine:
https://toolset.com/forums/topic/cred-notifications-using-wrong-timezone/#post-578078

For the question:
To confirm that this actually works for you, please set your server to something besides the UTC timezone.
Please describe detail steps to duplicate same problem, how and where should I change the UTC timezone? thanks

#578643

I'd need to know what OS your VM was running. Please escalate this to the next level if it is needed.

For now, I believe it is a problem with how CRED handles timezones related to custom post types vs notifications.
The reason?
I created a new custom field on a separate install. Upon submittal, this is the value in the database for it:
wpcf-start-datetime - 1508446800
Which translates to 10/19/2017 9PM (UTC). This is incorrect, as it should be 9pm in PDT, but WordPress display it correctly on the backend.

For that same post, when I look into the cred notification data (in __cred_notification_data), it shows:

a:1:{i:838;a:2:{s:9:"cred_form";i:838;s:7:"current";a:3:{s:4:"time";i:1507928028;s:11:"post_status";s:5:"draft";s:8:"snapshot";s:0:"";}}}

That "time" is not the same custom field but the post date instead. Strangely, that translates to 10/13/2017 8:53PM (UTC) which, adjusted for timezones, is actually correct.

So the disconnect seems to be in how CRED treats timezones when they're storing data in custom fields vs when they're spitting them back out for notifications.

#578896

There isn't same problem in my localhost(PHP7.1), as you mentioned above:
https://toolset.com/forums/topic/cred-notifications-using-wrong-timezone/#post-578309
This problem only exists in one of your website, which is using PHP7, and there isn't same problem in your another website, which is using PHP 5.

So it should be a server problem, according to our support policy:
https://toolset.com/toolset-support-policy/
We cannot fix compatibility issues with your server.

If it is a bug, we need to duplicate same problem, then I can escalate this thread, please provide detail steps to duplicate same problem,how and where should I change the UTC timezone?
I am using Windows 10 + XAMPP

#579141

Are you using Win10 in a VM? Or something else? I don't know what OS you're using for your server setup. Changing the time from anything besides UTC should be relatively simple (just google it). Once you do so, run the same test you did above and see if it reports the correct times in the email.

#579248

I am using windows 10, no VM, could you just describe detail steps for how do you change the UTC settings in your problem webserver? then I will be able to find the settings in my localhost, thanks

#579693

I'm using CentOS for a server, so changing my timezone works like this:

hidden link

Yours is going to be dramatically different.

#579774

The link you mentioned above is talking about changing the time zone, and in my localhost the time zone is UTC+8(Beijing Time), the settings should satisfied as you described in post:
https://toolset.com/forums/topic/cred-notifications-using-wrong-timezone/#post-578309
set your server to something besides the UTC timezone.

it works fine in my localhost with a fresh wordpress installation + PHP 7.1:
https://toolset.com/forums/topic/cred-notifications-using-wrong-timezone/#post-578078

So the problem only exists in your website server, it should be a server problem, if you still need assistance for it, please provide a test site with the same problem, and fill below private detail box with login details and ftp access, I need a live website to test and debug this problem, thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.