Help Desk

Tickets/Info not hidden for password protected event

  • Topics: 1
    | Permalink

    Hi – I password protected an event, but when the page loads (prior to entering password) the eventbrite ticket info comes up anyway. I really need this to be part of what is hidden until the password is entered.

    In fact, I need for all of the event info to be hidden until a password is entered, but the Event, Venue, Address, Date, contact Email Address, etc all shows up.

    Is there a way to suppress all of that until a password is entered?

    Thanks,
    Michael

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Michael,

    I think you can solve this by simply adding a conditional wrapper to check whether or not the event post is password protected. You can do that by editing /wp-content/plugins/the-events-calendar/views/single.php – make a copy of this and place in an ‘events’ folder in your theme. Then wrap all the code in the following:

    Put this at the top of single.php:

    if ( post_password_required() ) {
    	$output = get_the_password_form();
    	echo $output;
        } else {
    

    ..and this all the way at the bottom:

    }
    

    You’ll need to wrap that code in PHP tags so it executes properly too.

    I’m not sure whether or not this should be built in to our templates and will create a ticket for the devs to take a look.

    Let me know whether or not this helps.

    Cheers,
    Jonah