• Resolved ben2358723823567

    (@ben2358723823567)


    Hi, it’s me again! One last little request and the project is done πŸ™‚ I’m willing to make a 10$ donation AND give it 5 stars if you can update the plugin with this request or tell me how I can achieve this if it’s already possible to do that right now (I did not find out how yet).

    What I need is a shortcode to display a table of all event tickets that are up for sale (and if possible only showing those that still have tickets available, so ignoring the ones that are completely sold out)

    I know I can use this notation: [tickets events=”6,7,8″]

    …but the site owner would rather not have to manually update the shortcode with all the ID’s whenever they create new events.

    A notation like this (or whatever) is what we’re after: [tickets events=”all”]

    Why not make a notation like this to show only the available events that still have some tickets left for sale too: [tickets events=”available”]

    Are you up to it, Joe? πŸ˜€
    10$ + 5 stars review πŸ˜‰

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    Hi, Ben –

    I can’t respond to this message. I am explicitly not allowed to provide any kind of compensation (financial or labor) in exchange for a review; it’s a violation of the terms of use of this repository that could get my plugin banned.

    If you wish to provide a review, please do, but I can’t explicitly perform services in exchange for one.

    Thread Starter ben2358723823567

    (@ben2358723823567)

    OK, were you to update the plugin with the changes, I WOULDN’T donate any money πŸ˜‰ and I WOULDN’T give it a 5 star rating. JUST SAYING… I would absolutely not do that.

    Thread Starter ben2358723823567

    (@ben2358723823567)

    Basically, all I need (and I’m sure this could benefit the whole community that uses your tickets plugin!) is that whenever we put a shortcode like this [tickets events=”*”] in a page, then your query grabs all tickets for sale, ordered say in upcoming events date ASC order and it displays all of them it in the same exact template you already got for this shortcode [tickets events=”6,7,8″] (bulk-tickets.php)

    EDIT: Well, there you go Ben, here’s the new tickets shortcode handler function, just replace it in place and you’re done, that’s it. Hey thanks Ben! Well, you’re welcome Ben! NP Ben, have a nice weekend! You too Ben. KTHXBYE.

    function mt_featured_tickets( $atts, $content = '' ) {
    	$atts = shortcode_atts(
    		array(
    			'events'   => false,
    			'view'     => 'calendar',
    			'time'     => 'month',
    			'template' => '<h3>{post_title}: {event_begin format="l, F d"}</h3><p>{post_excerpt}</p>',
    		),
    		$atts
    	);
    	if ( $atts['events'] ) {
    		$events = explode( ',', $atts['events'] );
    	} else {
    		$events = array();
    	}
    	$content = '';
    	if ( is_array( $events ) ) {
    		foreach ( $events as $event ) {
    			if($event == '*'){
    				$posts = get_posts([
    					'meta_key' => '_mc_event_data',
    					'post_type' => 'ai1ec_event',
    					'post_status' => 'publish',
    					'numberposts' => -1,
    					'order' => 'ASC',
    					'orderby' => 'order_clause',
    						'meta_query' => array(
    							'order_clause' => array(
    								'key' => '_mc_event_date',
    								'type' => 'NUMERIC'
    							)
    						)
    				]);
    				if(is_array($posts)){
    					foreach($posts as $post) {
    						$event		= $post->ID;
    						$post       = get_post( $event, ARRAY_A );
    						$event_data = get_post_meta( $event, '_mc_event_data', true );
    						$data       = apply_filters( 'mt_ticket_template_array', array_merge( $event_data, $post ) );
    						$event_data = "<div class='mt-event-details'>" . mt_draw_template( $data, $atts['template'] ) . '</div>';
    						$content   .= "<div class='mt-event-item all-events'>" . $event_data . mt_registration_form( '', $event, $atts['view'], $atts['time'], true ) . '</div>';
    					}
    				}
    			}
    			else{
    				$event_data = get_post_meta( $event, '_mc_event_data', true );
    				$post       = get_post( $event, ARRAY_A );
    				if ( is_array( $post ) && is_array( $event_data ) ) {
    					$data       = apply_filters( 'mt_ticket_template_array', array_merge( $event_data, $post ) );
    					$event_data = "<div class='mt-event-details'>" . mt_draw_template( $data, $atts['template'] ) . '</div>';
    					$content   .= "<div class='mt-event-item'>" . $event_data . mt_registration_form( '', $event, $atts['view'], $atts['time'], true ) . '</div>';
    				}
    			}
    		}
    	}
    
    	return "<div class='mt-event-list'>" . $content . '</div>';
    }
    Plugin Author Joe Dolson

    (@joedolson)

    Latest release does something like this, although not exactly this. Use [tickets], with no arguments, to generate a list of upcoming events with tickets. This is pending an update to My Calendar, as well, before it can work with My Calendar events, however.

    Thread Starter ben2358723823567

    (@ben2358723823567)

    Oh OK thanks, I might check it out, but the above completely resolved my needs and the app is now online, so it’s good as is for us. Also, feel free to pull and publish whatever you want from the handler function I posted above. Note that it doesn’t change anything to your previous version’s behavior, it only adds that whenever the parameter is a star, it lists all the events, so it’s harmless, it just adds functionality, doesn’t change previous functionality πŸ™‚

    I gave 5 stars to your plugin BTW πŸ™‚

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shortcode to display all event tickets up for sale? [tickets events=”all”]’ is closed to new replies.