The MU forums have moved to WordPress.org

trying to hack sideblog (1 post)

  1. Ovidiu
    Member
    Posted 17 years ago #

    hello

    I am using the sideblog plugin from here: http://katesgasis.com/2006/05/02/sideblog-plugin-v30/ and the eventcalendar plugin from here: http://wpcal.firetree.net/2006/11/02/v310/

    I am trying to get the sideblog to display its output sorted by the event date instead of the postdate.

    here is the relevant original code:


    $now = current_time('mysql');
    $sideblog_contents = $wpdb->get_results("SELECT $wpdb->posts.ID,
    $wpdb->posts.post_title, $wpdb->posts.post_content,
    $wpdb->posts.post_date FROM $wpdb->posts, $wpdb->post2cat
    WHERE $wpdb->posts.ID = $wpdb->post2cat.post_id AND
    $wpdb->post2cat.category_id = $asidecategory AND
    $wpdb->posts.post_status ='publish' AND
    $wpdb->posts.post_password ='' AND $wpdb->posts.post_date
    < '" . $now . "' ORDER BY $wpdb->posts.post_date DESC LIMIT " . $limit);

    I tried this:


    $now = current_time('mysql');
    $sideblog_contents = $wpdb->get_results("SELECT $wpdb->posts.ID,
    $wpdb->posts.post_title, $wpdb->posts.post_content,
    $wpdb->ec3_schedule.start, $wpdb->posts.post_date FROM
    $wpdb->posts, $wpdb->ec3_schedule, $wpdb->post2cat WHERE
    $wpdb->posts.ID = $wpdb->post2cat.post_id AND
    $wpdb->post2cat.category_id = $asidecategory AND
    $wpdb->posts.post_status ='publish' AND
    $wpdb->posts.post_password ='' AND $wpdb->posts.post_date
    < '" . $now . "' ORDER BY $wpdb->ec3_schedule.start DESC LIMIT " . $limit);

    and got this error message:

    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 ' wp_2_posts.post_date FROM wp_2_posts, , wp_2_post2cat WHERE wp]
    SELECT wp_2_posts.ID, wp_2_posts.post_title, wp_2_posts.post_content, .start, wp_2_posts.post_date FROM wp_2_posts, , wp_2_post2cat WHERE wp_2_posts.ID = wp_2_post2cat.post_id AND wp_2_post2cat.category_id = 9 AND wp_2_posts.post_status ='publish' AND wp_2_posts.post_password ='' AND wp_2_posts.post_date < '2006-11-11 18:20:08' ORDER BY .start DESC LIMIT 3

    could anyone give me some hints? it appears it is completely ignoring ec3_schedule if you look carefully at the code.

About this Topic

  • Started 17 years ago by Ovidiu