Home › Forums › Calendar Products › Community Events › Standardize actions on Community Event login forms
- This topic has 3 replies, 4 voices, and was last updated 9 years, 3 months ago by
Frederick.
-
AuthorPosts
-
December 12, 2016 at 9:55 am #1204778
Frederick
ParticipantIn the-events-calendar-community-events/src/Tribe/Main.php, there’s a function, login_form, that CE uses to generate the standard WP Login form when users aren’t logged in and that option is toggled. We use two-factor authentication that requires using the default WP Login interface.
It would be nice for CE to default to just redirecting people to wp-login.php, though I understand that may not be preferable for all use cases. An action would be perfectly fine, but unfortunately actions are not uniformly called when
login_form()is.doVenueForm()anddoOrganizerFormdo not call any actions, whiledoMyEvents()callstribe_ce_event_list_login_formanddoEventForm()callstribe_ce_event_submission_login_form.Can you just drop a singular unifying action in
login_form()so that I can run a redirect whenever the login form is called? This solves the main problem (an action that needs to be taken whenever the login form is called) while maintaining backward compatibility for those who specifically wanted to target either the list or event submission forms.Apologies if this should have been a feature request, but I didn’t think it really met those standards, which seemed to be more aimed at front-end or functionality changes.
Thanks.
December 12, 2016 at 10:52 am #1204815George
ParticipantHi Frederick,
The login_form() method within Community Events itself calls the core WordPress function wp_login_form().
This function within WordPress core has its own set of filters.
Now, it’s true that the function has filters, not actions. But since you exit or die upon a call of wp_redirect() anyways, this shouldn’t matter.
So you can use one of WordPress core’s built-in filters here like as follows:
add_filter( 'login_form_top', 'tribe_ce_force_redirect_to_login_page' );function tribe_ce_force_redirect_to_login_page() {
wp_safe_redirect( wp_login_url() );
exit;
}☝️ Add that to your theme’s functions.php file, and any time someone arrives at the Community Events submission page while not being logged in, they will be redirected to wp-login.php
Cheers,
GeorgeJanuary 3, 2017 at 8:35 am #1212586Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Standardize actions on Community Event login forms’ is closed to new replies.
