Jason

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: tickets only available to certain user types #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 ); 
Viewing 1 post (of 1 total)