Home › Forums › Calendar Products › Community Events › Redirect to custom login
- This topic has 11 replies, 2 voices, and was last updated 8 years, 4 months ago by Nico.
-
AuthorPosts
-
December 15, 2015 at 1:03 pm #1041878smythkowalczykParticipant
Can I redirect users to a custom login page (siteurl/login) when logged out users try to access the community submission areas? Instead of the default login that shows.
December 16, 2015 at 11:06 am #1042409NicoMemberHi @smythkowalczyk,
Thanks for getting in touch with us!
While there’s no settings to do this, Brain gave a nice explanation on how this works and how to customize it here.
Please check that thread and let me know if it answers your question,
Best,
NicoDecember 16, 2015 at 2:22 pm #1042493smythkowalczykParticipantSorry, I don’t really understand. I have the settings to only allow logged in users to submit events. So when I type in the url’s: events/add or events/list I get the login form shown here:
Is this from wordpress or events calendar. I’d like it to route to my custom login url if possible. Or just a plain message to say that you must be logged in to access…
December 17, 2015 at 11:42 am #1043108NicoMemberHey Smyth,
Thanks for following up with this!
The form you are seeing is generated by WordPress, via the wp_login_form function.
Can you send over your site url? Not sure of how this is displaying in the site, Are you only seeing the login form?
Best,
NicoDecember 18, 2015 at 7:01 am #1043594smythkowalczykParticipantThis reply is private.
December 18, 2015 at 3:31 pm #1043846NicoMemberThis reply is private.
December 18, 2015 at 4:33 pm #1043861smythkowalczykParticipantThis reply is private.
December 21, 2015 at 7:32 am #1044738NicoMemberHey Smyth,
Thanks for your patience on this! To redirect the user to your custom form just add the snippet below to your theme functions.php file:
add_action ( 'tribe_ce_event_submission_login_form', 'tribe_ce_redirect_login' ); function tribe_ce_redirect_login ( ) { wp_safe_redirect( site_url('/login/') ); exit; }
You can append a redirect_to parameter in the URL to redirect the user to the submit event form after the login if the custom login plugin supports it.
Please give the snippet a try and let me know,
Best,
NicoDecember 21, 2015 at 10:47 am #1044799smythkowalczykParticipantNico, that’s MONEY! One more thing though. I get the same ugly login if a logged out user tries to access the list page. Any way to add that to the code?
December 23, 2015 at 9:50 am #1046022NicoMemberMusic to my ears Smyth! We can hook the same function to the tribe_ce_event_list_login_form action…
add_action ( 'tribe_ce_event_submission_login_form', 'tribe_ce_redirect_login' );
add_action ( 'tribe_ce_event_list_login_form', 'tribe_ce_redirect_login' );function tribe_ce_redirect_login ( ) {
wp_safe_redirect( site_url('/login/') );
exit;
}
Please give it a try and let me know,
Best,
NicoDecember 23, 2015 at 11:52 am #1046060smythkowalczykParticipantOutstanding! You do nice work Nico. Thanks again.
SmythDecember 23, 2015 at 12:32 pm #1046077NicoMemberGlad to be of service Smyth 🙂
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Best wishes for the holidays,
Nico -
AuthorPosts
- The topic ‘Redirect to custom login’ is closed to new replies.