• The “Event” and “Event Calendar” widgets do not check to see that the Category IDs requested are actually real. This causes a MySQL error.

    (So how do we find out what the Event Manager Category IDs are?)

    em-object.php version 5.1.3 lines 337-344

    }elseif( self::array_is_numeric($category) ){
        $term_ids = array();
        foreach($category as $category_id){
          term = new EM_Category($category_id);
          if( $term !== false && !is_wp_error($term) ){
            $term_ids[] = $term->term_taxonomy_id;
         }
        }

    $term->term_taxonomy_id needs to be checked to see if it actually has anything.

    http://wordpress.org/extend/plugins/events-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • hope this link might give you an idea http://wp-events-plugin.com/updating-to-v5/ part of that link is about EM category however we will still going to check this one.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    that code would be correct, it checks to see if the $term didn’t produce an error, so it should skip non-existant categories.

    do you get SQL errors?

    Thread Starter BillHeaton

    (@billheaton)

    It was the SQL error that signaled the problem.

    With the Category IDs set to “2,3,4” I get the following SQL Error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',) ) AND (event_status`=1 ) ORDER BY event_start_date ASC, event_start_tim’ at line 3]
    SELECT wp_em_events.post_id FROM wp_em_events LEFT JOIN wp_em_locations ON wp_em_locations.location_id=wp_em_events.location_id WHERE (recurrence!=1 OR recurrence IS NULL) AND ( event_start_date >= CAST(‘2012-03-02’ AS DATE) OR (event_end_date >= CAST(‘2012-03-02’ AS DATE) AND event_end_date != ‘0000-00-00’ AND event_end_date IS NOT NULL)) AND wp_em_events.post_id IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (,,) ) AND (event_status=1 ) ORDER BY event_start_date ASC, event_start_time ASC, event_name ASC LIMIT 4 OFFSET 0`

    Regards,
    Bill

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    hi Bill, I’ll test this out and fix if I can reproduce. you may want to try this out with your other plugins disabled, because I think something is messing with the results making EM think the terms actually exist.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Events Manager] Widgets fail on bad Category IDs’ is closed to new replies.