• I’m using WP Events Manager and I’ve restricted the reservations for a specific user role, so they need to login first. I’m also using a plugin to manage users registrations and profiles (RegistrationMagic and ProfileGrid).

    When the user access the event page and login to complete the process he’s redirected to profile page page instead of the same event page.

    How can I change this behavior? Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • I came here to look for the answer to this exact same question. @fgiorgio – Did you figure out a solution?

    Thread Starter f.giorgio

    (@fgiorgio)

    @jasonbongreen not found anything, other plugins have a specific option for this

    @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!

    I contacted them via their website, so hopefully this gets fixed in a future build.

    Thread Starter f.giorgio

    (@fgiorgio)

    Thank you @jasonbongreen, unfortunately this is not solving my issue. I think that the plugin I’m using to manage the users (RegistrationMagic and ProfileGrid) is forcing a redirect to the user profile after login.

    That seems likely. I ended up landing on Profile Builder for creating a front-end login experience and front-end profile editing page. The free version met all my needs and works well in tandem with Events Manager. My theme (GeneratePress) comes with a helpful system called Elements, that let’s me inject content at any hook, so I used that to add an events navigation system to the events area of the site after someone logs in. Feel free to check it out. I’m almost ready to launch, I’ve just got to work through all the email configuration to make sure users have a logical experience.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Login redirection’ is closed to new replies.