Limit ticket purchases to logged in users

Home Forums Ticket Products Event Tickets Plus Limit ticket purchases to logged in users

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #737843
    Cory
    Participant

    Is there a hook that will allow me to wrap the tickets template with is_logged() or user role checking function? Please advise. Need to hide ticketing option for all non-members.

    #738015
    Geoff
    Member

    Hey there Ryan!

    Great question. Yes, you can customize the tickets template so the ticketing option is wrapped in a is_logged() condition like that.

    You would want to add that condition in the class-wootickets.php template. Here’s the documentation for that template. I would also suggest checking out our Themer’s Guide to walk you through how to set up your own customizations without touching the core plugin.

    Does that make sense? Will that work for you? Please let me know. Cheers!

    Geoff

    #746614
    Cory
    Participant

    SO I tried this in the views -> tickets.php file:

    if ( $is_there_any_product ) {
    ?>
    <h2 class=”tribe-events-tickets-title”><?php _e( ‘Reserve Spot’, ‘tribe-wootickets’ );?></h2>
    <?php if ( is_logged() ) { ?>
    <?php echo $contents; ?>
    <?php if ( $is_there_any_product_to_sell ) { ?>
    <tr>
    <td colspan=”4″ class=’woocommerce’>

    <button type=”submit” class=”button alt”><?php esc_html_e( ‘Add to cart’, ‘tribe-wootickets’ );?></button>

    </td>
    </tr>
    <?php
    }
    }
    else { ?>
    <h4>You must be logged in as a Pro Stylist to request online reservations.</h4>
    <?php
    }

    }
    }
    ?>

    #747049
    Geoff
    Member

    Cool, did that end up doing the trick? If so, that would be helpful for other people looking for a similar solution.

    #751393
    Cory
    Participant

    When I added this all it did was hide the ticket form entirely. Any ideas here?

    #751460
    Geoff
    Member

    It looks like you may have an additional closing brackets on the end there. Is that the case?

    #753128
    Cory
    Participant

    Working now. Good catch. Thank you.

    #753141
    Geoff
    Member

    My pleasure! Thanks again for reaching out and confirming that everything works. 🙂

    I’m going to go ahead and close this thread, but please feel free to hit us back up if you run into any other questions.

    Cheers!
    Geoff

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Limit ticket purchases to logged in users’ is closed to new replies.