[EventCalendar] Eventcalendar conflicts with wp-sticky [WAS: MySQL
error using Event calendar together with wp-sticky]
Peter Allgeyer
allgeyer at web.de
Thu May 17 16:51:47 UTC 2007
Hi Developers,
I took a closer look on it (also see my comments in
http://forums.lesterchan.net/index.php/topic,376.0.html).
The following code form eventcalendar3.php leads to massive plugin
conflicts with wp-sticky and maybe others, too:
/** 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';
if($ec3->order_by_start && preg_match($regexp,$orderby,$match))
{
if($match[1] && $match[1]==' DESC')
$orderby=preg_replace($regexp,'ec3_sch.start',$orderby);
else
$orderby=preg_replace($regexp,'ec3_sch.start DESC',$orderby);
}
return $orderby;
}
It conflicts with "function sticky_orderby" from sticky.php
(see output below):
function sticky_orderby($content) {
global $wpdb;
$content = "($wpdb->sticky.sticky_status = 2 AND
$wpdb->sticky.sticky_status IS NOT NULL) DESC,
DATE_FORMAT($wpdb->posts.post_date,'%Y-%m-%d') DESC,
($wpdb->sticky.sticky_status = 1 AND $wpdb->sticky.sticky_status IS
NULL) DESC, DATE_FORMAT($wpdb->posts.post_date,'%T') DESC";
return $content;
}
Can we replace the regular expression by something more special?
Why has ist to be:
$regexp='/\bpost_date\b( DESC\b| ASC\b)?/i';
and not (note the substituted question mark):
$regexp='/\bpost_date\b( DESC\b| ASC\b)+/i';
And last but not least: Is where any better solution then using a regexp
replacement of a SQL statement? It may break other plugins, too.
BR, PIT
Am Samstag, den 05.05.2007, 23:44 +0200 schrieb Peter Allgeyer:
> Hi!
>
> I'm using the Beta 2 version of WP-Sticky with Wordpress Ver. 2.1.3. I
> have the Event Calendar Widget (3.1.1_rc1) installed and this seems to
> be causing a problem. When the WP-Sticky is activated the events page is
> trashed. Clicking any event in the calendar gives a MySQL error message:
>
> ---< schnipp >---
> 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 'DESC,'%Y-%m-%d') DESC, (wp_sticky.sticky_status = 1
> AND wp_sticky.sticky_status ' at line 1]
>
> SELECT SQL_CALC_FOUND_ROWS wp_posts.*, wp_sticky.sticky_status FROM
> wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id)
> LEFT JOIN wp_ec3_schedule ec3_sch ON ec3_sch.post_id=id LEFT JOIN
> wp_sticky ON wp_sticky.sticky_post_id = wp_posts.ID WHERE 1=1 AND
> wp_post2cat.category_id IN (9) AND (post_type = 'post' AND (post_status
> = 'publish' OR post_status = 'private')) AND ((YEAR(start)=2007 AND
> MONTH(start)=05 AND DAYOFMONTH(start)=09) OR (start<='2007-05-09 0:0:0'
> AND end>='2007-05-09 0:0:0')) GROUP BY wp_posts.ID ORDER BY
> (wp_sticky.sticky_status = 2 AND wp_sticky.sticky_status IS NOT NULL)
> DESC, DATE_FORMAT(wp_posts.ec3_sch.start DESC,'%Y-%m-%d') DESC,
> (wp_sticky.sticky_status = 1 AND wp_sticky.sticky_status IS NULL) DESC,
> DATE_FORMAT(wp_posts.ec3_sch.start DESC,'%T') DESC LIMIT 0, 5
> ---< schnapp >---
>
> Maybe due to a plugin conflict in queries. I can't find the error, my
> SQL is somewhat to bad. Anyone who can help?
>
BR, PIT
---------------------------------------------------------------------------
copyleft(c) by | Windows without the X is like making love
Peter Allgeyer | _-_ without a partner. -- MaDsen Wikholm,
| 0(o_o)0 mwikholm at at8.abo.fi
---------------oOO--(_)--OOo-----------------------------------------------
More information about the EventCalendar
mailing list