tickets only available to certain user types

Home Forums Ticket Products Event Tickets Plus tickets only available to certain user types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1050226
    Jason
    Participant

    Hi,
    I’d like some types of tickets to be available to logged in WordPress editors.
    What would be the best way to go about this?
    I envisioned being able to add a checkbox when I create a ticket type, and if it was checked, hide it on the public site, except for editors. Is that possible?

    Or can I create pre-defined ticket types that the admin must use (ie can’t create his own ticket types). Then I can program it so one of these ticket types doesn’t show on the front-end.

    Is there a list of the plugin’s hooks online somewhere, maybe I can use these to program something. I see the code that renders the ticket fields on the front end is in /events-tickets-plus/src/views/wootickets/tickets.php

    #1051307
    Geoff
    Member

    Hi Jason,

    That’s a really interesting idea! I wish I could say that was an options right out of the box, but am afraid it’s not. In fact, I’d suggest you add it to our feature request forum if you have a moment because I can see how that would be a neat feature others would find useful.

    That said, I do believe it would be possible to make this happen, though it would take some custom development. You’re already on the right track as far as knowing the template you’d need to modify. From there, you might explore adding some conditional statements within the loop for tickets that would limit the display for certain tickets, perhaps based on Product or even Event category?

    Sorry I don’t have a concrete solution for you, but does this at least help answer your question? Please let me know.

    Cheers!
    Geoff

    #1051507
    Jason
    Participant

    Hi Geoff,
    If there was a hook somewhere in the ../tickets/php file, then I could alter the plugin without my changes getting wiped next time the file is updated.
    To get around this, I have added some code to my functions.php file, which outputs jquery to hide the ticket type based on the name of the ticket if the user is not an editor or admin. In the below example, the name of the ticket is ‘booth’.

    function bp_custom_ticket_js() {
    	if (!current_user_can( 'editor') && !current_user_can( 'administrator') && strstr($_SERVER['REQUEST_URI'], '/event') == true) {
    		?>
    		<script>			
    			$('.tribe-events-tickets  td.tickets_name').each(function () { 
    				//alert($(this).html() );
    				if ( $(this).html().toLowerCase().indexOf("booth")  != -1 ) {
    				// this is a booth, so hide it
    				$(this).parent().css( "display", "none" );
    			}
    			});
    		</script>
    <?php
    		 
    	}
    }
    add_action( 'wp_footer', 'bp_custom_ticket_js', 99999 ); 
    #1051942
    Geoff
    Member

    That is rad! Nice work and thanks for sharing. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘tickets only available to certain user types’ is closed to new replies.