WordPress.org

Support

Support » Plugins and Hacks » WP-PostRatings Cheater » [Resolved] Fix for error when database prefix is not wp_

[Resolved] Fix for error when database prefix is not wp_

  • Hi there,

    We just installed your plugin on one site to test it. This site has another database prefix (not wp_) and your plugin shows no results.

    In order to make it work, we have made following changes in wp-postratings-cheater-settings.php.

    We would be very happy you could include them in your next release:

    Original code in wp-postratings-cheater-settings.php – Lines 83-86:
    $sql = "select a.meta_id, a.post_id, a.meta_key, a.meta_value, b.post_title ".
    "from wp_postmeta as a join wp_posts as b on a.post_id = b.id ".
    "where a.meta_key = 'ratings_score' ".
    "order by a.post_id;";

    Changed code in wp-postratings-cheater-settings.php – Lines 83-86 + 1 additional code line:

    $dbprefix = $wpdb->base_prefix;
    $sql = "select a.meta_id, a.post_id, a.meta_key, a.meta_value, b.post_title ".
    "from " . $dbprefix . "postmeta as a join " . $dbprefix . "posts as b on a.post_id = b.id ".
    "where a.meta_key = 'ratings_score' ".
    "order by a.post_id;";

    Hope you find it interesting and include it in your plugin code.

    https://wordpress.org/plugins/wp-postratings-cheater/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Fix for error when database prefix is not wp_’ is closed to new replies.
Skip to toolbar