[EventCalendar] Serious Problem with the Post Levels Plugin

firetree_ec3 at spamex.com firetree_ec3 at spamex.com
Tue Sep 18 01:16:37 UTC 2007


There are a number of problems between the EventCalendar 3 plugin (which I love), and the Post Levels 1.1.1 Plugin (http://fortes.com/2007/02/16/post-levels-111/). I really, REALLY want to use Post Levels, but I can't. The reason is that you guys are doing the same thing, and you collide.

There seem to be a couple of problems in the template-functions.php file.

One can be fairly easily fixed:

Starting at line 113 (ec3_util_calendar_days function):
  $sql=
    "SELECT DISTINCT
       id,
       post_title,
       GREATEST(start,'$begin_date') AS start_date,
       LEAST(end,'$end_date') AS end_date,
       allday,
       1 AS is_event
     FROM $wpdb->posts,$ec3->schedule
     WHERE post_status='publish'
       AND $ec3->schedule.post_id=id
       AND end>='$begin_date'
       AND start<'$end_date'";

If you make the following change, it addresses that problem:

Change "AND post_id=id" to:"AND $ec3->schedule.post_id=id".

The other problem is a great deal harder to address, and I am stumped. It involves the query you construct starting at line 379 (ec3_get_events function):

  $calendar_entries = $wpdb->get_results(
    "SELECT DISTINCT
       p.id AS id,
       post_title,
       start,
       u.$ec3->wp_user_nicename AS author,
       allday
     FROM $ec3->schedule s
     LEFT JOIN $wpdb->posts p ON s.post_id=p.id
     LEFT JOIN $wpdb->users u ON p.post_author = u.id
     WHERE p.post_status='publish'
       AND end>='$ec3->today' $and_before
     ORDER BY start $limit_numposts"
  );

What happens here is that Post Levels inserts JOIN LEFTs inside your JOIN LEFTs and MySQL throws a hissy fit.

Basically, you guys are both doing the same thing. Maybe you can write the SQL to be a bit more robust. I dunno.

In a competition between them, EC3 wins, but I would really, REALLY like to be able to use Post Levels.

Yours,

Chris Marshall




More information about the EventCalendar mailing list