Home › Forums › WoodMart support forum › Error from woodmart template-tags file
Error from woodmart template-tags file
- This topic has 18 replies, 2 voices, and was last updated 5 years, 5 months ago by Artem Temos.
-
AuthorPosts
-
June 10, 2019 at 9:03 am #127834
keizershaquilParticipantHi,
I noticed that my webiste is slow and sometimes it gives me a 502 error. After that I read the php error logs and there are two error that appear in almost every line of the file:
– in_array() expects parameter 2 to be array, null given in /www/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php on line 1769
– Trying to get property ‘roles’ of non-object in /www/wp-content/themes/woodmart/inc/integrations/woocommerce/template-tags.php on line 1761Is there anyway to solve it?
June 10, 2019 at 11:36 am #127855
Artem TemosKeymasterHello,
Could you please disable all plugins that are not related to our theme and provide us your admin access so we can check it? Also, send us access to your error logs so we see them.
Thank you in advance
June 18, 2019 at 6:36 am #129004
keizershaquilParticipantHi,
I found out that the 502 error was being caused by Woocommerce Admin plugin. But the template tag error is still appearing in recent logs.June 18, 2019 at 9:31 am #129054
keizershaquilParticipant.
June 18, 2019 at 11:23 am #129027
Artem TemosKeymasterCould you please disable all plugins that are not related to our theme and provide us your admin access so we can check it? We need access to your error logs live since we have to check if they appear after some changes.
June 19, 2019 at 7:52 am #129184
keizershaquilParticipantHi,
I made a exact copy of my website to my staging and you can make the tests there.Have a nice day,
Eunice VassoaJune 19, 2019 at 1:25 pm #129192
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file
function woodmart_my_account_navigation( $items ) { $user_info = get_userdata( get_current_user_id() ); $user_roles = property_exists( $user_info, 'roles' ) ? $user_info->roles : array(); unset( $items['customer-logout'] ); if ( class_exists( 'YITH_WCWL' ) ) { $items['wishlist'] = get_the_title( yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) ) ); } if ( class_exists( 'WeDevs_Dokan' ) && apply_filters( 'woodmart_dokan_link', true ) && ( in_array( 'seller', $user_roles ) || in_array( 'administrator', $user_roles ) ) ) { $items['dokan'] = esc_html__( 'Vendor dashboard', 'woodmart' ); } $items['customer-logout'] = esc_html__( 'Logout', 'woodmart' ); return $items; } add_filter( 'woocommerce_account_menu_items', 'woodmart_my_account_navigation', 15 );
June 20, 2019 at 7:54 am #129368
keizershaquilParticipantHi,
I checked the logs an now it gives me a different warning: PHP Warning: First parameter must either be an object or the name of an existing class in /www/wp-content/themes/woodmart-child/functions.php on line 504
Line 504 has the following code: $user_roles = property_exists( $user_info, ‘roles’ ) ? $user_info->roles : array();
Can I get a hand with this too, please.Have a nice day,
Eunice VassoaJune 20, 2019 at 9:21 am #129394
Artem TemosKeymasterTry to replace that line with the following one
$user_roles = ( $user_info && property_exists( $user_info, 'roles' ) ) ? $user_info->roles : array();
June 20, 2019 at 12:35 pm #129433
keizershaquilParticipantIt is still giving the same message.
June 20, 2019 at 12:37 pm #129435
Artem TemosKeymasterCould you please send us a step by step instruction how to reproduce the error and send us your admin and FTP access?
June 21, 2019 at 6:08 am #129522
keizershaquilParticipantThe error is simply showing in the php logs.
I think it just shows everytime a page is reloaded or an action is executed.June 21, 2019 at 6:30 am #129533
Artem TemosKeymasterWe have to be able to check your error logs live to understand if the problem fixed or not.
June 21, 2019 at 1:51 pm #129614
keizershaquilParticipantHi,
Can you please provide me an email that I can use to create a user so you can have live access to the logs?June 21, 2019 at 1:58 pm #129615
Artem TemosKeymasterYou can use this email
June 24, 2019 at 5:36 am #129737
keizershaquilParticipantHi,
Sorry for the late reply. I sent an invitation to that email account so you can join the collaboration team and have access to the logs.Have a nice day,
Eunice VassoaJune 24, 2019 at 9:20 am #129742
Artem TemosKeymasterWe don’t see the error now.
June 27, 2019 at 6:29 am #130280
keizershaquilParticipantHi,
It’s strange because I didn’t do nothing special.
Since the issue is gone I think this ticket can be closed now.Have a nice day,
Eunice VassoaJune 27, 2019 at 1:31 pm #130281
Artem TemosKeymasterYou are welcome.
-
AuthorPosts
Tagged: template tag
- You must be logged in to create new topics. Login / Register