@fgiorgio – I figured out a fix, so I thought I’d share it.
I think this is actually a bug in Events Manager. I think the plugin developers intend the user to stay on the same event page after login. Furthermore, the user is supposed to remain in the place on the event page (rather than scrolling the browser back to the top of the page).
The code that governs redirect behavior after logging in on an event page can be found here:
/wp-content/plugins/events-manager/templates/forms/bookingform/login.php
On line 26, you will find the specific code.
<input type="hidden" name="redirect_to" value="<?php $protocol = is_ssl() ? 'https' : 'http'; echo esc_url( $protocol . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); ?>#em-event-booking-form">
The good news is that Events Manager supports custom templates. They provide documentation here:
Using Template Files – Events Manager Documentation (wp-events-plugin.com)
Create a copy of the login.php file I mention above in the following directory in your WordPress install:
/wp-content/plugin-templates/events-manager/forms/bookingform/login.php
Make sure it is in that exact folder. The guide doesn’t do a good job of specifying the folder for that particular template, so it took me a bunch of trial and error to figure out.
Now open your new login.php “template” and change line 26 (which is what I listed above) with this:
<input type="hidden" name="redirect_to" value="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>#em-event-booking-form">
That’s what worked for me.
Now one qualifier here… I’m not a PHP expert. It looks like their original code was trying to handle http vs https redirects. I do have a SSL certificate on my site (https) and my code worked fine for me. Let me know if it works for you.
I’m going to try to report this to the developers.
Good luck!