Redirect to custom login

Home Forums Calendar Products Community Events Redirect to custom login

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1041878
    smythkowalczyk
    Participant

    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.

    #1042409
    Nico
    Member

    Hi @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,
    Nico

    #1042493
    smythkowalczyk
    Participant

    Sorry, 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:login

    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…

    #1043108
    Nico
    Member

    Hey 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,
    Nico

    #1043594
    smythkowalczyk
    Participant

    This reply is private.

    #1043846
    Nico
    Member

    This reply is private.

    #1043861
    smythkowalczyk
    Participant

    This reply is private.

    #1044738
    Nico
    Member

    Hey 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,
    Nico

    #1044799
    smythkowalczyk
    Participant

    Nico, 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?

    #1046022
    Nico
    Member

    Music 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,
    Nico

    #1046060
    smythkowalczyk
    Participant

    Outstanding! You do nice work Nico. Thanks again.
    Smyth

    #1046077
    Nico
    Member

    Glad 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

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Redirect to custom login’ is closed to new replies.