hi! The error produces a critical error on the website and the user can’t move forward. Does the link allow you to view it?
Right but that’s a generic error message, I can’t help without seeing the technical info behind it. Can you take a look in the PHP error log on your site and try to find the corresponding fatal error message?
Hi John, thanks for getting back to me. I’ve obtained the PHP error log and found this repeated fatal error (site root shortened below):
PHP Fatal error: Uncaught TypeError:
user_switching::switch_back_url(): Argument #1 ($user)
must be of type WP_User, bool given,
called in wp-content/cache/acorn/framework/views/4518aee64706605bad1ad9628b5f89c369cef95f.php
on line 29 and defined in
wp-content/plugins/user-switching/user-switching.php:1029
The stack trace shows user_switching::switch_back_url(false) and identifies this theme template:
wp-content/themes/inagrafton/resources/views/sections/header-sms.blade.php
This happens when I click “Switch To” from the Users screen. We recently migrated the site to WP Engine, and we don’t have access to the original theme developers.
Does this indicate that the theme’s custom switch-back link needs a check for a valid user before calling switch_back_url()? Any guidance on the correct implementation would be appreciated. Thank you!
Continued troubleshooting and found code from the prior developer, that didn’t update with the theme’s plugin updates and we discovered the flaw, and were able to fix it. Thank you. Resolved 🙂
Thanks for letting me know. Glad you got it fixed!