Hi Support
We are recently receiving the following PHP errors pertaining to the Toolset-provided code snippet "conditional-redirect-on-successful-login" in a previous ticket. This worked fine before. The error is preventing any new users from being logging in successfully on the site.
ERROR MESSAGE:
Fatal error: Uncaught Error: Call to undefined function str_contains() in /.../dev/wp-content/toolset-customizations/conditional-redirect-on-successful-login.php:64 Stack trace: #0 /.../dev/wp-includes/class-wp-hook.php(303): my_login_redirect('hidden link...', 'hidden link...', Object(WP_User)) #1 /.../dev/wp-includes/plugin.php(189): WP_Hook->apply_filters('hidden link...', Array) #2 /.../dev/wp-login.php(1178): apply_filters('login_redirect', 'hidden link...', 'hidden link...', Object(WP_User)) #3 {main} thrown in /.../dev/wp-content/toolset-customizations/conditional-redirect-on-successful-login.php on line 64
Our original ticket for the redirect code snippet was this one:
https://toolset.com/forums/topic/conditional-login-in-different-languages-with-wpml-enabled/
and a subsequent tickets addressed an issue while logging in in German:
https://toolset.com/forums/topic/conditional-redirects-not-working-for-all-roles-in-german/
whereafter it worked too. So I don't understand why it has stopped working all of a sudden as we didn't change that code since.
The issue does not occur for successfully registered users of role "native_nanny" or "family", so I suspect that the redirect issue is only for brand new users (roles "unverified_family" and "unverified_nanny"), who would be redirected to a different place, as given by the Toolset Code Snippet "conditional-redirect-on-successful-login".
STEPS TO REPRODUCE:
1) Click either "Sign Up" to register as a new Unverified Family or "Become a Native Nanny" to register as a new Unverified Nanny
2) Fill out the email, first name, last name, password and do reCaptcha if necessary.
3) You are redirected to the login form. Once you enter the email address and password just specified the error occurs.
I found during testing that if you follow the following steps, you will see that the login was successful, but the redirect is failing.
4) Immediately after you get the error, click Back on the browser
5) You are taken back to the login screen and it looks like you're not logged in, however if you simply click the WPML language flag top right, you will see that the login works and you ARE redireted to the login page in German, but you are acutally logged in, as can be seen in the menu top right. It has changed to the menu for logged in users.
Thanks and best regards
Simon