James

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: jQuery conflict (2.1.0) #1207727
    James
    Participant

    This reply is private.

    in reply to: Disable Archives #1139912
    James
    Participant

    That seems to have done the trick.

    Thank you very much 🙂

    in reply to: Custom WP Query #1122078
    James
    Participant

    I’ve found a work around, but involves hacking the events plugin so I’m hoping you can help me with a more elegant solution.

    I’ve commented out line 658 in the-events-calendar/src/Tribe/Query.php
    $order_sql = "EventStartDate {$order}";

    Which has stopped events calendar adding an order by to any WP Query. This has fixed the conflict with the GMW plugin.

    I’ve then added the following to my other queries that need to be ordered by Event date:

    'orderby' => '_EventStartDate',
    'order' => 'ASC',

    Obviously this will break in any future plugin updates though.

    in reply to: Custom WP Query #1122052
    James
    Participant

    It’s a bit complicated. I’m using a global map feature in geo my wp which prepares the query automatically on a post type, the problem being that it shows all events not just future events.

    So i’m using a hook to add query arguments to the query:

    function gmw_filer_global_maps( $gmw ) {
    
        $gmw['query_args'] = array(
            //'suppress_filters' => true,
              'post_type' => 'tribe_events',
              'posts_per_page' => '12',
              'orderby' => 'none',
              //'post_status'    => 'publish',
              // 'meta_query'     => array(
              //   array(
              //     'key'     => 'event_date',
              //     'value'   => array( date( 'Ymd', strtotime( '-1 day' ) ), date( 'Ymd', strtotime( '+31 days' ) ) ),
              //     'compare' => 'BETWEEN',
              //     'type'    => 'DATE'
              //   ) 
              //)
            );
    
        var_dump($gmw['query_args']);
        return $gmw;
    }
    add_filter( 'gmaps_gmpt_form_before_posts_query', 'gmw_filer_global_maps' );

    So the issue is that that it produces this query:

    SELECT
    				SQL_CALC_FOUND_ROWS *
    			FROM (
    				SELECT  DISTINCT wp_posts.ID, wp_posts.post_type, gmwlocations.lat, gmwlocations.long,
    			gmwlocations.address, gmwlocations.formatted_address, gmwlocations.map_icon,
    			gmwlocations.phone, gmwlocations.fax, gmwlocations.email, gmwlocations.website  FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_postmeta as tribe_event_end_date ON ( wp_posts.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' )  INNER JOIN wp_places_locator gmwlocations ON ID = gmwlocations.post_id  WHERE 1=1  AND ( 
      wp_postmeta.meta_key = '_EventStartDate'
    ) AND wp_posts.post_type = 'tribe_events' AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_value >= '2016-06-03 07:07:45' OR (wp_postmeta.meta_value <= '2016-06-03 07:07:45' AND tribe_event_end_date.meta_value >= '2016-06-03 07:07:45' )) AND ( gmwlocations.lat != '0.000000' AND gmwlocations.long != '0.000000' )  ORDER BY EventStartDate ASC 
    			) a
    			GROUP BY IF( post_parent = 0, ID, post_parent )
    			ORDER BY EventStartDate ASC
    			LIMIT 0, 12

    So it hasn’t got the ‘as EventStartDate’ defined at the start of the query, so it breaks when it tries to order by ‘EventStarteDate’ at the end. As I said, I don’t need it to order by EventStartDate, and so if I can just stop the events calendar adding this bit to query it will work fine.

    Is there any way to do that?

    Thanks,
    James

    in reply to: Ticket email sends depending #1096872
    James
    Participant

    Is there a way to get details of the order in that function?

    in reply to: Disable Virtual Product #1096831
    James
    Participant

    I’m doing something very similar, except my client wants the option for virtual and physical tickets.

    My plan is to try and stop making tickets virtual, and then only send the email if they select the virtual delivery method (I have no idea if this is possible yet, some of your code might help).

    I tried using the update post meta, with a post transition hook, but it turned out the was something firing after the hook setting the ticket back to being virtual.

    Anyway, I’ve found that this works:

    /**
    * Stop tickets being virtual
    */
    function make_ticket_physical($post_ID, $post_after, $post_before){
        if($post_after->post_type == 'product'){
            update_post_meta( $post_ID, '_virtual', 'no');
        }
    }
    
    add_action( 'save_post', 'make_ticket_physical', 999999999999999999999, 3 ); 

    Edit: You don’t actually need $post_before

    Now i’ve got to try and work out how to only send the ticket email if they’ve chosen virtual delivery…

    • This reply was modified 8 years, 1 month ago by James.
    in reply to: Geo my WP integration #1070926
    James
    Participant

    Thanks, got it working.

    For anyone that stumbles upon this I used a combination of the above action and http://docs.geomywp.com/gmw_pt_update_location/ to insert the location from events calendar, into the geomywp table. (I had to copy parts of the actual function from the plugin folder and adapt it to work for me).

    in reply to: Geo my WP integration #1070611
    James
    Participant

    Thanks George, I’ll have a play with that and see what I can achieve. That should do the trick with a bit of database work.

    Future integration with geomywp would be a great addition to a future release.

Viewing 8 posts - 1 through 8 (of 8 total)