[EventCalendar] Re: Ignore post_date when start set (corrected)

Jacob Kennedy jacob.kennedy at sears.ca
Thu Jul 19 20:01:32 UTC 2007


I'm almost there.

In eventcalendar3.php, function ec3_filter_posts_where(&$where) I changed 
the line :
        $where.=" AND (($where_post_date) OR ($where_start)) ";
to
        $where.=" AND (($where_post_date  AND id NOT IN (SELECT DISTINCT 
post_id FROM $ec3->schedule)) OR ($where_start)) ";

and in template-functions.php, function 
ec3_util_calendar_days($begin_month_id,$end_month_id) I altered it to look 
like this:
  if(!$ec3->show_only_events)
  {
    // We are interested in normal posts, as well as events.
    $sql="( $sql ) UNION
     ( SELECT DISTINCT
         id,
         post_title,
         post_date AS start_date,
         post_date AS end_date,
         0 AS allday,
         0 AS is_event
       FROM $wpdb->posts
       WHERE post_status='publish'
         AND post_date>='$begin_date'
         AND post_date<'$end_date'
         AND post_date<NOW()
                 AND id NOT IN (SELECT DISTINCT post_id FROM 
$ec3->schedule)
     )";
  }

(the last line is what I added)

Now I've got it filtering exactly as I want it on the calendar and 
whenever a date query is performed.  The only missing link appears to be 
on the home page.  I would have thought that it WAS performing a date 
query on the home page (something like WHERE post_date <= Now()) but if it 
was it should have gone through the filter I altered, right?

I'm on the final leg... any hints?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20070719/6485d882/attachment.htm


More information about the EventCalendar mailing list