Skip Navigation

[Resolved] Critical error – Toolset view – Follow up

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 – 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/Karachi (GMT+05:00)

This topic contains 9 replies, has 3 voices.

Last updated by Waqar 1 year, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2631361

Hi

Sorry for the slow reply, my previous ticket got closed (https://toolset.com/forums/topic/critical-error-toolset-view/).

It seems to be an issue with the custom code snippet you provided:

`add_filter( 'wpv_filter_query', 'func_custom_date_filter_query', 10, 3);
function func_custom_date_filter_query( $view_args, $view_settings, $view_id ){

if ( 71155 == $view_id ) {

if ( (isset($view_args['meta_query'])) && (!empty($view_args['meta_query'])) ) {

$target_field = "_wpscp_schedule_draft_date"; // change this field slug to your field slug

foreach ($view_args['meta_query'] as $key => $value):

if ($value['key'] == $target_field){

$date_range = explode(",",$value['value']);
$start = date('Y-m-d', $date_range[0]);
$end = date('Y-m-d', $date_range[1]);
$view_args['meta_query'][$key] = array('key' => $target_field,
'value' => array($start,$end),
'type' => 'DATE',
'compare' => 'BETWEEN' );
}
endforeach;
}

}

return $view_args;
}`

Any ideas why this may have suddenly stopped working?

Says fatal error.
/public_html/wp-content/toolset-customizations/toolset-custom-code.php on line 21

I had a look in the debug.log file and the last few lines show this:

#18 /home/629785.cloudwaysapps.com/xucgrdhgth/public_html/wp-includes/template-loader.php(106): include('/home/629785.cl...')
#19 /home/629785.cloudwaysapps.com/xucgrdhgth/public_html/wp-blog-header.php(19): require_once('/home/629785.cl...')
#20 /home/629785.cloudwaysapps.com/xucgrdhgth/public_html/index.php(17): require('/home/629785.cl...')
#21 {main}
thrown in /home/629785.cloudwaysapps.com/xucgrdhgth/public_html/wp-content/toolset-customizations/toolset-custom-code.php on line 21

Thanks.

#2631681

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share screenshot of your custom code snippet or send me admin access details and tell me where exactly with what custom code snippet you added the above code? Also share the problem URL for which you added the code snippet.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2634979

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately the admin access details you shared with me is not working at this end.

Can you please send me working admin access details.

I have set the next reply to private which means only you and I have access to it.

#2635531

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I checked but as its your production site I would like to debug this on test server.

I tried but I do not able to locate whats the cause of the issue yet as I need to activate debug mode but as its production site we should not do that.

Is it possible for you to send me duplicator copy of your site?

More info:
- https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2637587

Hi

I had to remove the links because its not set to private reply.

Please set to private and then I can send.

#2637699

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I have set the next reply to private which means only you and I have access to it.

#2637953

Had to delete the links again this time it was a private reply but I guess because I did not put anything in the password fields etc it did not make it a private reply so had to remove the links again.

Please set a private reply and I guess I can fill dummy info in the password fields etc

#2638193

Hi,

Minesh is on vacation, so I'll be following up this ticket.

The provided admin access details no longer work. I'm setting your next reply as private again, so that you can share the website's duplicator package.

regards,
Waqar

#2640027

Thank you for the link and I managed to successfully deploy the website's clone on my test server.

I'll be performing some tests on this clone and will share the findings, as soon as this testing completes.

Thank you for your patience.

#2640625

Thank you for waiting, while I performed some troubleshooting around this custom code snippet.

Most likely, your website was earlier using PHP 7 and this error started appearing when you upgraded to PHP 8.
(In PHP 7, an issue like this is treated as a warning but PHP 8 treats this as a Fatal error)

Please replace the line:


if ($value['key'] == $target_field ) {

With:


if ( (isset($value['key'])) && ($value['key'] == $target_field) ) {

And the line:


unset($view_args['meta_query'][$k]);

With:


unset($view_args['meta_query'][$key]);

This should fix the error.

#2641497

Awesome that fixed it, thanks a lot! 🙂