[EventCalendar] WordPress 2.5

Andrew Kieschnick andrewk at austin.rr.com
Sat Mar 29 21:26:27 UTC 2008


The following patch seems to be enough to make EventCalendar 3.1.1 rc3 
work with WordPress 2.5. The problems I saw were that "Keep Events 
Separate" hid events from the Manage page, and date and order SQL wasn't 
being rewritten correctly so viewing events for a particular time gave 
the events published then, not scheduled then. Also ec3.js was 
generating a URL that didn't work - I had that problem with WordPress 
2.3.3 also.


--- eventcalendar3.php.orig	2007-10-22 14:29:52.000000000 -0500
+++ eventcalendar3.php	2008-03-29 15:57:59.000000000 -0500
@@ -138,14 +138,14 @@
 {
   global $ec3,$wp_query,$wpdb;
 
-  if($wp_query->is_page || $wp_query->is_single)
+  if($wp_query->is_page || $wp_query->is_single || $wp_query->is_admin)
       return $where;
 
   if($wp_query->is_date):
 
      // Transfer events' 'post_date' restrictions to 'start'
      $df='YEAR|MONTH|DAYOFMONTH|HOUR|MINUTE|SECOND|WEEK'; // date fields
-     $re="/ AND (($df)\(post_date(,[^\)]+)?\) *= *('[^']+'|\d+\b))/i";
+     $re="/ AND (($df)\($wpdb->posts\.post_date(,[^\)]+)?\) *= *('[^']+'|\d+\b))/i";
      if(preg_match_all($re,$where,$matches)):
        $where_post_date = implode(' AND ',$matches[1]);
 
@@ -164,7 +164,7 @@
        //   OR the rdate/rtime is between start..end:
        $where_start=
        sprintf("(%1\$s) OR (start<='%2\$s' AND end>='%2\$s')",
-         preg_replace('/\bpost_date\b/','start',$where_post_date),
+         preg_replace("/\b$wpdb->posts\.post_date\b/",'start',$where_post_date),
          str_replace( "'", '', implode('-',$rdate).' '.implode(':',$rtime) )
        );
 
@@ -239,8 +239,8 @@
 /** Change the order of event listings (only advanced mode). */
 function ec3_filter_posts_orderby(&$orderby)
 {
-  global $ec3;
-  $regexp='/\bpost_date\b( DESC\b| ASC\b)?/i';
+  global $ec3, $wpdb;
+  $regexp="/\b$wpdb->posts\.post_date\b( DESC\b| ASC\b)?/i";
   if($ec3->order_by_start && preg_match($regexp,$orderby,$match))
   {
     if($match[1] && $match[1]==' DESC')
--- ec3.js.orig	2008-03-28 03:32:20.000000000 -0500
+++ ec3.js	2008-03-28 03:38:57.000000000 -0500
@@ -101,7 +101,14 @@
       var caption_text=ec3.month_of_year[month_num0] + ' ' + year_num;
       if(c && c.firstChild && c.firstChild.nodeType==ec3.TEXT_NODE )
       {
-        c.href=ec3.home+'/?year='+year_num+'&monthnum='+month_num;
+	if(month_num<10) 
+	{
+	  c.href=ec3.home+'/?m='+year_num+'0'+month_num;
+	}
+	else
+	{
+	  c.href=ec3.home+'/?m='+year_num+month_num;
+	}
         if(ec3.catClause)
            c.href+=ec3.catClause; // Copy cat' limit from original month link.
         c.title=ec3.viewpostsfor;



More information about the EventCalendar mailing list