Forced site log in

Home Forums Calendar Products Community Events Forced site log in

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1478069
    spiceyux
    Participant

    Is it possible to:
    Force the authentication to route through wordpress native login:
    https://indivisiblenwi.org/wp-login.php
    vs the Community Events implementation of it:
    https://indivisiblenwi.org/events/community/add

    The issue is that I have CAPTCHA enabled for the site and attempting to login through the events implementation always fails because the CAPTCHA is not present there. Currently using:

    reCaptcha

    I basically want to route all authentication requests through the native mechanism

    #1479561
    Victor
    Member

    Hi Sam!

    Thanks for reaching out to us! Let me help you with this topic.

    There is no built-in option to disable the community login form, but you can use the snippet George shared in the following topic to achieve that > https://theeventscalendar.com/support/forums/topic/standardize-actions-on-community-event-login-forms/#dl_post-1204815

    Let me also note that we have a built-in implementation of captcha for the event submission form > https://theeventscalendar.com/knowledgebase/setting-recaptcha-community-events/

    I hope that helps. 🙂 Let me know if you have any follow up questions.

    Best,
    Victor

    #1481104
    spiceyux
    Participant

    Thanks Victor,

    I ended up doing something similar. I wasn’t aware of the wp_safe_redirect(). (My WP skills are a bit rusty).
    One thing to add that I did:

    
    function tribe_ce_login_redirect( $post_id ) {
    	global $wp;
    	$current_url = home_url(add_query_arg(array(),$wp->request));
     	header("Location: /wp-login.php?cestate=required&redirect_to=" . urlencode($current_url) );
    	return;
    }
    add_action( 'tribe_community_before_login_form', 'tribe_ce_login_redirect' );
    
    function the_tribe_ce_login_message( $message ) {
        $tribe_ce_login_messaging = htmlspecialchars($_GET["cestate"]);
    	$cemessage;
    	if(!empty($tribe_ce_login_messaging)){
    		if($tribe_ce_login_messaging='required'){
    			$cemessage = 'Events require an account to submit or edit.';
    		}
    		return '<p class="message">' . $cemessage . '</p>';
    	}
    	return;
    }
    add_filter( 'login_message', 'the_tribe_ce_login_message' );
    

    I grabbed the current url so that, after login, it would redirect back to the originating url.
    Also, passing a query string param so I can message on the native login for that, “Events require an account.”

    I’ll make some updates to leverage the wp_safe_redirect() but wanted to share in case it helps anyone in the future.

    • This reply was modified 8 years, 1 month ago by spiceyux.
    • This reply was modified 8 years, 1 month ago by spiceyux.
    #1482826
    Victor
    Member

    Hey Sam!

    It’s great to know you could solve the issue!

    Thanks for following up and for sharing the code. I’m sure other users will find it useful.

    I’ll close this thread now, but feel free to open a new topic if anything comes up and we’ll be happy to help. 🙂

    Cheers,
    Victor

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Forced site log in’ is closed to new replies.