Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ModiVivendi

    (@modivivendi)

    Thankfully I was able to sort things out myself. It was the dreaded functions.php file of the theme after all.

    Thread Starter ModiVivendi

    (@modivivendi)

    What a marvelous place the Blogosphere is. In addition to posting here did I also send out a couple of emails to bloggers who seemed to use the same combination of plugins and what do you know this is one of the answers and after following the advice it turns out to be a solution as well.

    Having asked for permission from frenchy @ http://www.frenchysfracas.com this is the entire email containing said solution:

    Hi Jan,

    I did the worst thing: I edited the file.. ;o)

    First things first: I’m currently using Popularity Contest 1.2.1 and Sideblog WordPress Plugin 3.6 (most recent version is 3.8).

    So, basically it’s a slight adjustment of the select statement – using a DISTINCT fetches just one distinct row of data. The Sideblog plugin, the Popularity Contest plugin and whatever’s changed since WordPress 2.1 gets us the double rows of the same data.

    1. find the popularity-contest.php file in your plugins directory
    2. make a backup copy and put somewhere in a different folder than the plugins folder (or else it
    might show up in your plugins admin page)
    3. edit the popularity-contest.php file:


    – function show_top_ranked

    function show_top_ranked($limit, $before, $after) {
    global $wpdb;
    $temp = $wpdb;
    $join = apply_filters(‘posts_join’, ”);
    $where = apply_filters(‘posts_where’, ”);
    $groupby = apply_filters(‘posts_groupby’, ”);
    if (!empty($groupby)) { $groupby = ‘ GROUP BY ‘.$groupby; }
    $posts = $wpdb->get_results(“
    >>> SELECT DISTINCT ID, post_title
    FROM $wpdb->posts
    LEFT JOIN $wpdb->ak_popularity pop
    ON $wpdb->posts.ID = pop.post_id
    $join
    WHERE post_status = ‘publish’
    AND post_date < NOW()
    $where
    $groupby
    ORDER BY pop.total DESC
    LIMIT “.intval($limit)
    );

    – function show_top_ranked_in_cat

    function show_top_ranked_in_cat($limit, $before, $after,
    $cat_ID = ”) {
    if (empty($cat_ID) && is_category()) {
    global $cat;
    $cat_ID = $cat;
    }
    if (empty($cat_ID)) {
    return;
    }
    global $wpdb;
    $temp = $wpdb;

    $join = apply_filters(‘posts_join’, ”);
    $where = apply_filters(‘posts_where’, ”);
    $groupby = apply_filters(‘posts_groupby’, ”);
    if (!empty($groupby)) { $groupby = ‘ GROUP BY ‘.$groupby; }

    $posts = $wpdb->get_results(“
    >>> SELECT DISTINCT ID, post_title
    FROM $wpdb->posts
    LEFT JOIN $wpdb->post2cat pc
    ON $wpdb->posts.ID = pc.post_id
    LEFT JOIN $wpdb->ak_popularity pop
    ON $wpdb->posts.ID = pop.post_id
    $join
    WHERE pc.category_id = ‘”.intval($cat_ID).”‘
    AND post_status = ‘publish’
    AND post_date < NOW()
    $where
    $groupby
    ORDER BY pop.total DESC
    LIMIT “.intval($limit)

    – function show_top_ranked_in_cat

    function show_top_ranked_in_month($limit, $before, $after,
    $m = ”) {
    if (empty($m) && is_archive()) {
    global $m;
    }
    if (empty($m)) {
    global $post;
    $m = get_the_time(‘Ym’);
    }
    if (empty($m)) {
    return;
    }
    $year = substr($m, 0, 4);
    $month = substr($m, 4, 2);
    global $wpdb;
    $temp = $wpdb;

    $join = apply_filters(‘posts_join’, ”);
    $where = apply_filters(‘posts_where’, ”);
    $groupby = apply_filters(‘posts_groupby’, ”);
    if (!empty($groupby)) { $groupby = ‘ GROUP BY ‘.$groupby; }

    $posts = $wpdb->get_results(“
    >>> SELECT DISTINCT ID, post_title
    FROM $wpdb->posts
    LEFT JOIN $wpdb->ak_popularity pop
    ON $wpdb->posts.ID = pop.post_id
    $join
    WHERE YEAR(post_date) = ‘$year’
    AND MONTH(post_date) = ‘$month’
    AND post_status = ‘publish’
    AND post_date < NOW()
    $where
    $groupby
    ORDER BY pop.total DESC
    LIMIT “.intval($limit)

    I’m attaching both plugins, I’m not sure if I changed anything in the Sideblog plugin file..

    Best of Luck!

    regards,
    frenchy!

Viewing 2 replies - 1 through 2 (of 2 total)