Skip Navigation

[Resolved] _cred_post_expiration_time is not respecting timezone or problem with view query

This support ticket is created 3 years, 2 months ago. 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 20 replies, has 3 voices.

Last updated by simonM-5 3 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1962759

To try the first method first, does that mean I just have to replace the text "cred_submit_complete" to "cred_save_data" in the custom code for the current ticket (stored in code snippet "preserve-ad-expiry-date")?
Yes, you will change cred_submit_complete to cred_save_data in the current ticket code snippet, and you must also change the priority parameter - the 3rd parameter - in add_action. The priority is currently 10, but to access the expiration timestamp with cred_save_data, the priority parameter must be at least 11.

I'm not sure what you are talking about when you talk about "priority" in the sentences?
I'm talking about priority in the context of WordPress add_action. In essence, the third parameter here:

add_action( $tag, $function_to_add, $priority, $accepted_args );

Priority is used to dictate the order in which callbacks assigned to the same hook are executed. Many callbacks can be assigned to the same action, so priority allows you to programmatically adjust the sequence of those callbacks.
https://developer.wordpress.org/plugins/hooks/actions/#priority

We have other custom code from Jamal in place which duplicates all posts to the other languages in the snippet "func-create-ad-language-duplicates-on-submission". There it would appear that the WPML API is being used, if I'm not mistaken.
I agree, this snippet appears to be responsible for duplicating the nanny/job posts automatically into other languages, but I'm not aware of all the custom code involved so that is only a guess. If there is any doubt, you could deactivate this snippet temporarily and test both form submissions again. If no duplicate posts are generated, you can be certain this code snippet is reponsible for duplication.

#1962841

Hi Christian

Thanks for the tip on priorities.

I updated our snippet "preserve-ad-expiry-date" thus:
add_action('cred_save_data', 'populate_job_ad_expiry',11,2); ....
and
add_action('cred_save_data', 'populate_nanny_ad_expiry',11,2);

and retried. That didn't work. Then I changed the priority of the snippet "func-create-ad-language-duplicates-on-submission" from
add_action( 'cred_save_data', 'quick_duplicate_save_data_action', 10, 2 );
to
add_action( 'cred_save_data', 'quick_duplicate_save_data_action', 12, 2 );

so as I understand it should run after the snippet "preserve-ad-expiry-date", however still not seeing the custom column in the language duplicate.

Kind regards
Simon

#1963103
Screen Shot 2021-02-22 at 2.33.03 PM.png

Hi, I just checked with the WPML team to verify that wpml_make_post_duplicates function does indeed copy custom field values, they confirmed that custom field values should be copied. This function should duplicate everything including those values, even if they are not set to "Copy" in WPML > Settings > Multilingual content setup.

I just created a test Nanny Ad in English:
hidden link

The system duplicated this ad into German automatically:
hidden link

It looks like the expiration date was copied successfully here (screenshot attached).

Perhaps there was a caching issue when you tested, or perhaps there is something else going on. Can you test again? I'm using the toolset support account to log in, and I created my ad from this page:
hidden link

#1963727

Hi Christian

That is weird. I tested again and confirm that the copying is happening, also double checked on the database. I can also confirm that the the standard WPML duplication procedure also copies custom fields, as we have other custom fields on the Ads which have been copying across fine, so it appears to be working well now.

Just for my sanity though 🙂 ... which cache were you referring to? Browser? WordPress? Toolset? Are there some caches that I should be deleting when adding new snippets to ensure testing is working?

Thanks and regards
Simon

#1964721

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Christian is currently unavailable and i'm covering for him.

Based on Christian's testing it would appear everything is working fine.

However in your case it doesn't work when you try testing. Seeing that you don't have any caching plugins installed i'm assuming he is referring to the server's cache or your browsers cache.

Seeing that you also mentioned that it works for you as well then caching can be ruled out.

Thanks,
Shane

#1967823

My issue is resolved now. Thank you!

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