Support

Home Forums Event Espresso Premium EE4 Event Registration Redirect Users to Separate Login Page

EE4 Event Registration Redirect Users to Separate Login Page

Posted: December 11, 2017 at 4:53 am


Tony

  • Support Staff

December 11, 2017 at 6:26 am

Hi there,

With the EE4 user integration add-on you”ll find the option ‘Registration Page URL (if different from default WordPress Registration)’ that you can set in:

Event Espresso -> Registration from -> User Integration Settings

If you set the URL you want to use for registrations there EE will direct the user to that, is that what you are looking for?

As for the redirect back, you’ll need to hook into whatever page you using for the custom registration and use a hook there. For example here’s how you redirect to the checkout page after using BuddyPress for site registrations:

https://gist.github.com/Pebblo/8e657cffab1ddd1bd16451fe567c02eb

What are you using for the custom registration page?


George

December 11, 2017 at 6:35 am

Hello Tony,

No, that’s not what I’m looking for.

I referring to the login form (Step 1) of event registration. I want my existing users to login in a separate page (already created) and then redirected back to the registration process form.


Tony

  • Support Staff

December 11, 2017 at 4:03 pm

You can redirect logged out users using something like:

https://gist.github.com/Pebblo/4c7521a7bde86f013d5f96b5f1de6adf

You may want to add some additional checking to that function to confirm the user is not logged in, however, the login step is currently only initialized if they are not.

The redirect back will depend on what you are using for your custom page, rather than using redirect_to as part of the query string, I would check if the user currently has an active cart session and redirect back to the cart if so, you’ll find an example of doing that in the first link I gave you above but will likely need to change the hook used for whatever login page you are using.


George

December 12, 2017 at 2:15 am

Thanks Tony, Just what i was looking for. I will implement the code example.

Please how do i check if the current(now logged-in user) has an active EE4 cart? Is there a function, filter or action hook that i can call to return a TRUE or FALSE to that?


Tony

  • Support Staff

December 12, 2017 at 2:26 am

No, but the other function I gave you shows you how to check if you have an active checkout in your session:

https://gist.github.com/Pebblo/8e657cffab1ddd1bd16451fe567c02eb#file-example-php-L6

If you are currently in a checkout session that will return and instanceof, otherwise null, so:

$checkout = EE_Registry::instance()->SSN->checkout();

if( $checkout instanceof EE_Checkout ) {
    //You have an active checkout session
}

Run that within the function you are using to return the user.


George

December 12, 2017 at 3:15 am

Hello Tony,

Works like a charm!

Here’s what i did:

	//Function to enable redirect non-logged in user to login at central login page then redirect back to register page after successful login
	add_action('AHEE__Single_Page_Checkout___initialize_reg_step__wpuser_login', function( EE_SPCO_Reg_Step_WP_User_Login $spco_step ){
		
		if( ! is_user_logged_in() ){
			$redirect_url = get_permalink();
			$checkout = EE_Registry::instance()->SSN->checkout();
			if( $checkout instanceof EE_Checkout ) {
				$redirect_url = $checkout->reg_page_base_url;
			}
			wp_safe_redirect( get_permalink( get_page_id_by_path('account') ).'?redirect_to='.$redirect_url );
		}
		return $spco_step;
		
	});

Solved my issue.

Thanks!


Tony

  • Support Staff

December 12, 2017 at 4:30 am

You’re most welcome.

The support post ‘EE4 Event Registration Redirect Users to Separate Login Page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 1 year, 6 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!