Skip Navigation

[Resolved] Notice: Trying to get property 'source_language_code' of non-object in

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

Our next available supporter will start replying to tickets in about 0.59 hours from now. 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: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

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

Assisted by: Jamal.

Author
Posts
#1822533

Hi Support

We got our custom codes editable again πŸ˜…, but now we are seeing an error message when we view the page hidden link:

Notice: Trying to get property 'source_language_code' of non-object in .../toolset-customizations/func-check-if-post-is-wpml-original.php on line 14

I don't believe the code changed so wondering what the error is.

I will need to provided you with a login, so please convert this to a ticket and open a private reply?

Thanks and regards
Simon

#1824049

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Simon,

I tried to check this issue, but I do not see any errors with both, nanny's and family's account. I am getting a 404 error for both accounts.
Can you tell me how to reproduce this issue? And I'll try with a copy that I have taken today for the previous ticket.

I might also need FTP access to check the debug.log file. Your next reply will be private to let you share credentials safely. ο»Ώ** Make a database backup before sharing credentials. **

#1825711

Hi Jamal

Quick update - I also spotted that the "old" function ts_is_post_wpml_original was still registered under Toolset > Settings > Front-end Content > Functions inside conditional evaluations. I registered the following two "new" functions there too, but still getting the error messages.
- func_is_job_ad_wpml_original
- func_is_nanny_ad_wpml_original

Do we still need to register those there if we use the shortcode for the conditional expression instead of the function version where we pass in the wpv_post_id as per your suggestion in an older ticket? (https://toolset.com/forums/topic/ajax-not-working-correctly-with-wpml/page/2/#post-1722943)

Thanks and regards
Simon

#1830627

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Simon,

In order to use a function or a shortcode inside conditionals, it needs to be registered.

I took a new Duplicator copy of your website and worked on it locally. It turns out that for some reason the shortcode needs to get the post ID. Replace:

[is_nanny_ad_wpml_original]

To:

[is_nanny_ad_wpml_original post='[wpv-post-id]']

I have also introduced a new check on the snippet "func-is-nanny-ad-wpml-original" line 14. Change:

if ( $info->source_language_code !== null) {

To:

if ( isset($info->source_language_code) && $info->source_language_code !== null) {

You will need to do the same for the Job Ads too.

I hope this helps. I'll remain at your disposal.

#1831765

HI Jamal

That's working now as far as I can see! Thanks for the code adjustment!

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.