Migrating from GD Star Rating to WP PostRatings On Your WordPress Site

I think most people like to get feedback on their writing. Comments are one form of feedback, but a comment requires significant effort from the user. An easier approach, from a user's perspective, is to give them a one-click rating system such as that provided by 2 popular plugins: GD Star Rating [no longer in the WordPress repository] and WP PostRatings.

For over a year I've been using GD Star Rating. It had the functionality I needed including the proper markup so that Google would display article ratings in its results. However, I've been increasingly anxious to move to another plugin from GD Star Rating for these reasons:

  1. It hasn't been updated in a while. The author has indicated that version 2.0 is in the works, but it seems like that's been the case for an unusually long time. And that's totally fair. The author is working for free and can certainly set his own priorities.
  2. The plugin is overly complex, in my opinion. Yes, it has a lot of functionality and can probably meet the varying needs of a lot of people, but as a result there are a lot of settings to understand and configure. While documentation exists, I don't necessarily want to commit the time to understanding the intricacies of the plugin or to put it another way, I'm lazy!
  3. Recently I was looking customize the output of the plugin. Namely, it was outputting the rating in text in addition to using stars. I thought that was redundant. Sadly, I couldn't (or was too lazy, see above) to figure out how to do it.

And so the search for a replacement plugin began. Luckily, the search was short as I quickly discovered Lester Chan's WP PostRatings. Aside from being generally well-received by the WordPress community, I know Lester's work well having used other plugins he's created.

Plugin downloaded and installed. It took just a few minutes to confirm it did everything I needed. One last challenge remained: How do I migrate my GD Star Rating data to WP PostRatings? A few searches via Google revealed no one else had published a solution for this. That meant I was going to have to tackle it on my own.

An hour an a half later, my data has been migrated! Want to do it as well? Here's what you'll need to do:

  1. Download and activate the WP PostRatings plugin. This is necessary so that a new table is added to your WordPress database.
  2. Connect to your WordPress database via MySQL.
  3. Run this query to copy the voting log data:
    INSERT INTO wp_ratings
    (rating_postid, rating_rating, rating_timestamp, rating_ip, rating_userid, rating_username, rating_posttitle)
    SELECT wp_gdsr_votes_log.id, wp_gdsr_votes_log.vote, UNIX_TIMESTAMP(wp_gdsr_votes_log.voted), wp_gdsr_votes_log.ip, '-1', 'GDSR Migration', wp_posts.post_title
    FROM wp_gdsr_votes_log, wp_posts
    WHERE wp_gdsr_votes_log.id = wp_posts.id
  4. Run these 3 queries to update the rating information for each post on your site:

    INSERT INTO wp_postmeta
    (post_id, meta_key, meta_value)
    SELECT wp_ratings.rating_postid, 'ratings_users', COUNT(wp_ratings.rating_postid)
    FROM wp_ratings
    GROUP BY wp_ratings.rating_postid

    INSERT INTO wp_postmeta
    (post_id, meta_key, meta_value)
    SELECT wp_ratings.rating_postid, 'ratings_score', SUM(wp_ratings.rating_rating)
    FROM wp_ratings
    GROUP BY wp_ratings.rating_postid

    INSERT INTO wp_postmeta
    (post_id, meta_key, meta_value)
    SELECT wp_ratings.rating_postid, 'ratings_average', SUM(wp_ratings.rating_rating) / COUNT(wp_ratings.rating_postid)
    FROM wp_ratings
    GROUP BY wp_ratings.rating_postid

    1. Your data has now been migrated. You can disable the GD Star Rating plugin and configure WP PostRatings to your liking.

      If you've liked this post, consider rating it below!

      1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 4.42 out of 5)
      Loading...

8 Comments

  1. This is great, i wonder if you could help me, i need even a simpler import/export.
    I am importing posts from 1 blog to another. Both using wp-postratings. I am using wordpress default importer for the whole process.
    The problem is it doesn't export the ratings. Basically what i would need is an SQL query to export the ratings from wp_22_postmeta to wp_postmeta

    Is this possible?

    Thank you.

    • It's been a while since I've worked with the ratings data so I'm not able assemble the proper SQL query just from memory. I think part of the trick will be ensuring that the old post IDs associated with the ratings get mapped properly to the new post IDs.

      • Hi, i guess the IDs will not match? So there's little hope. Thanks!

        • I'm 100% sure it can be done. All of the data is there in the databases. It would just take a little manipulating to get it right.

  2. Awesome! Thank you so much. YASR exports but doesn't have the widget functionality I need.

    This is brilliant and simple.

    • I'm glad you found this helpful. Thanks for letting me know!

  3. Great Post! One question though:
    I migrated successfully all data, but not the date/time.
    Is there a way to migrate it?

    Thank you again for you support!
    All the best
    Fracicone

    • Step 3 should migrate the date/time. Did it not for you?

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail.