Home › Toolset Professional Support › [Resolved] How to display Custom error message on forgot password page
Problem: I have added the wpv_forgot_password_form shortcode to a page so I can show a "forgot password" form to my clients. I would like to display a custom error message in the same page rather than redirecting, and I would like to customize the placement of the error message.
Solution: There aren't any options to change the location or text of the default error message. If you want to display a fully custom message, you could hide the default message with custom CSS and use conditional HTML to test the wpv_error parameter. We have the wpv-search-term shortcode you can use to test URL parameter values.
CSS:
/* hide the default error message */ #forgotpasswordform .wp-error { display:none !important; height:0; width:0; overflow:hidden; }
Conditional HTML for custom messages:
[wpv-conditional if="( '[wpv-search-term param="wpv_error"]' eq 'invalidcombo')"] Your custom invalid combo error message goes here [/wpv-conditional]
If you hide the default error message with CSS, you should create custom messages for all possible errors.
Relevant Documentation:
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-forgot-password-form
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Tagged: Views plugin
This topic contains 7 replies, has 2 voices.
Last updated by puneetS-3 4 years, 11 months ago.
Assisted by: Christian Cox.
I am trying to display an error message when the user enters the invalid email or username on the forgot password page that I was created using a shortcode
[wpv-forgot-password-form redirect_url='/login' redirect_url_fail=' ' reset_password_url='www.mywebsite.com/reset-password']
.
This redirects the user to the WordPress login form and the error comes as a part of URL of the login page, the structure of URL is "www.mywebsite.com/login/?wpv_error=invalidcombo" or "www.mywebsite.com/login/?wpv_error=invalid_email"
Is it possible to display an error message at the bottom of the same page instead of any redirection?
Hi, if you omit the redirect_url_fail attribute, the page should simply reload and an error message will be displayed on the same page. Here is the shortcode:
[wpv-forgot-password-form redirect_url='<em><u>hidden link</u></em>' reset_password_url='<em><u>hidden link</u></em>;
Please see the attached screenshot for an example of the "invalidcombo" error message. If you are seeing a different behavior, something else must be going on. I can take a closer look if you'd like.
Also, please be aware that redirect_url and reset_password_url should be absolute URLs, not relative or partial URLs. This is noted in the documentation here: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-forgot-password-form
Hi Christian Cox,
If I omit the redirect_url_fail attribute, the page reloads and an error message will be displayed on the same page.
I didn't find any screenshot.
I have one more query that can I customize the error message that is showing on the top of the form? Is it possible to add this to the bottom of the page?
I didn't find any screenshot.
I will attach the screenshot here, sorry.
I have one more query that can I customize the error message that is showing on the top of the form? Is it possible to add this to the bottom of the page?
There aren't any options to change the location or text of the default error message. If you want to display a fully custom message, you could hide the default message with custom CSS and use conditional HTML to test the wpv_error parameter. We have the wpv-search-term shortcode you can use to test URL parameter values.
CSS:
/* hide the default error message */ #forgotpasswordform .wp-error { display:none !important; height:0; width:0; overflow:hidden; }
Conditional HTML for custom messages:
[wpv-conditional if="( '[wpv-search-term param="wpv_error"]' eq 'invalidcombo')"] Your custom invalid combo error message goes here [/wpv-conditional]
If you hide the default error message with CSS, you should create custom messages for all possible errors.
Thank you for helping Christian Cox,
It is working with forgot password and reset password forms as URL has wpv_error parameter in these cases.
But I don't find any wpv_error parameter in the URL with a login form.
Is it possible to do the same with login form using the above mentioned conditional HTMLby you?
Okay!
I found the solution. I just change the parameter. If I use "fail_reason" instead of "wpv_error", it worked.
Here is the working conditional HTML for a login form:
[wpv-conditional if="( '[wpv-search-term param="fail_reason"]' eq 'invalid_username')"] Your custom error message goes here [/wpv-conditional]
Is the [wpv-conditonal] works with elementor pages?
Yes, the wpv-conditional shortcode can be used with elementor pages.
Okay!
My issue is resolved now.
Thank you!