Home › Forums › Calendar Products › Community Events › Failed Login redirect
- This topic has 7 replies, 3 voices, and was last updated 4 years, 9 months ago by Jeremy.
-
AuthorPosts
-
October 18, 2015 at 9:26 pm #1015710Mad DogParticipant
Using the default login page (/events/courses/list) if the login fails the user gets sent to the default ugly unbranded WP login page. First, this seems wrong. Isn’t there error trapping for this?
I solved it with a function I found (see below) and this works fine, but I wanted to check since it doesn’t seem like it should be necessary. Is there a better way to do this? Or error trapping for this I can modify or that isn’t working properly?
My function:
(add_action( 'wp_login_failed', 'thai_login_fail' ); function thai_login_fail( $username ) { $referrer = $_SERVER['HTTP_REFERER']; if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { wp_redirect('/events/courses/list' . '/?login=failed' ); exit; } }
Thanks!
October 19, 2015 at 10:18 am #1015915JoshParticipantHey Mad Dog,
Thanks for reaching out to us!
This is an interesting point and does make sense. Currently, the code snippet is needed to have the failed login redirect back to the community events login. I’ve created a new internal ticket for this and you’ll be notified if/when our team pushes forward with changing this behavior.
Thanks!
October 19, 2015 at 10:24 am #1015916Mad DogParticipantSeems it should be pretty simple to put error checking on the page so it stays there but an error message appears. In fact, I may need to add something to the page to display an error message (by way of the “failed login” URL parameter)so the user knows something happened and doesn’t just wonder what’s going on.
Keep me posted.
THANKS
October 19, 2015 at 2:32 pm #1015978Mad DogParticipantTwo questions:
1. Is the only way to add an error message to the login page by using a function?
2. When I do, using login_message doesn’t work.
I can use login_form_bottom to check if the URL parameter login=failed and it works and places a message jusst above the login form, but is there a better way to do this?
// Add LOGIN ERROR message to login page add_action( 'login_form_bottom', 'login_error_message' ); function login_error_message() { if (isset($_GET['login']) && $_GET['login'] == 'failed') { echo "<div class='login_error'>Login and Password don't match.<br />Please check them and try again.</div><br /><br />"; } }
Thanks!
October 20, 2015 at 12:09 pm #1016344JoshParticipantHey Mad Dog,
The login form for the community events plugin utilizes the “wp_login_form” function from WordPress. The way you have the error message added would work. Also, there are other options out there such as this one from the WordPress.org forums.
Let me know if this helps.
Thanks!
October 20, 2015 at 12:29 pm #1016352Mad DogParticipantIt works as I have it so I’ll leave it. Let me know if they redo the whole login page error trapping so it works more like we both think it should.
Thanks!
October 21, 2015 at 7:37 am #1016570JoshParticipantHey Mad Dog,
No problem. This thread has been added to our internal ticket for tracking this. You’ll be notified here as we make progress.
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new thread.
Thanks!
July 18, 2019 at 9:56 am #1838720JeremyKeymasterHi there!
Just wanted to share with you that a new release of our plugins is out which includes a fix for this issue.
Find out more about it → https://theeventscalendar.com/maintenance-release-for-the-week-of-15-july-2019/
We apologize for the delay and appreciate your patience while we worked on this.
As always, we suggest to setup a dev/staging site so you can make all plugin updates without disrupting the live site.
Please update the plugins and let us know if the fix works for you.
Cheers,
Jeremy -
AuthorPosts
- The topic ‘Failed Login redirect’ is closed to new replies.