WordPress.org

Ready to get started?Download WordPress

Forums

kk Star Ratings
[resolved] Upgrade to 2.0 and backward compatibility problem (4 posts)

  1. larsstorm
    Member
    Posted 1 year ago #

    First thanks for this nice plugin - enjoying it :)

    My problem is that after I upgraded to version 2.0, all the ratings on posts are not shown.

    I can find the old meta values in the database in the table wp_postmeta.

    Now as I read your code it seems as if the problem is focused around the detection of "Old_plugin".

    I was able to manually perform the db upgrade by forcing the following code in a is_admin() within the index.php file. However this is somewhat of a hack - that I doubt many else would be able to perform.

    if (is_admin()) {
    	echo "this is admin!";
    	// Update previous ratings
    	global $wpdb;
    	$table = $wpdb->prefix . 'postmeta';
    	$Posts = $wpdb->get_results("SELECT a.ID, b.meta_key, b.meta_value
    								 FROM " . $wpdb->posts . " a, $table b
    								 WHERE a.ID=b.post_id AND
    								 (
    									b.meta_key='_kk_ratings_ratings' OR
    									b.meta_key='_kk_ratings_casts' OR
    									b.meta_key='_kk_ratings_ips'
    								 ) ORDER BY a.ID ASC");
    	$Wrap = array();
    	foreach ($Posts as $post)
    	{
    		$Wrap[$post->ID]['id'] = $post->ID;
    		$Wrap[$post->ID][$post->meta_key] = $post->meta_value;
    	}
    	foreach($Wrap as $p)
    	{
    		update_post_meta($p['id'], '_kksr_ratings', $p['_kk_ratings_ratings']);
    		update_post_meta($p['id'], '_kksr_casts', $p['_kk_ratings_casts']);
    		$Ips = array();
    		$Ips = explode('|', $p['_kk_ratings_ips']);
    		$ip = base64_encode(serialize($Ips));
    		update_post_meta($p['id'], '_kksr_ips', $ip);
    		update_post_meta($p['id'], '_kksr_avg', round($p['_kk_ratings_ratings']/$p['_kk_ratings_casts'],1));
    	}
    }

    http://wordpress.org/extend/plugins/kk-star-ratings/

  2. Florence
    Member
    Posted 1 year ago #

    Yep, I'm having the same issue. The old votes are not displayed and I'm not able to cast new votes. It shows only the gray stars. I don't think I want to mess with my index page :p I've srewed it up before.

    I also saw that you included a feature that lets you decide the star sizes. That's awesome! Is there a way to have only have the stars on the archive pages be small, but not on the post pages? I asked about this before, and it couldn't be done. Maybe with this new version I'll have more luck?

    Lastly, I like the new settings pages! Only the links in the top left (Docs and changelog) are dead.

    Anyway, thanks for all of your hard work, Kamal. It is appreciated.

  3. Kamal Khan
    Member
    Plugin Author

    Posted 1 year ago #

    Hi

    First of all @larsstorm, there is no need for an is_admin() condition because this block will only run when the plugin is activated and that is already the admin. The block inside upgrades previous plugins, so all previous ratings are passed on to the new version.

    @Florence, thanks for you comment. The links will be working soon as I am very busy in other work and will work on the documentation when I get the time. About the archive pages you mentioned, I guess that is not a general problem for all users but tends to be specific to your website. Moreover I will see what I can do for this situation.

    Thank you

  4. Florence
    Member
    Posted 1 year ago #

    No worries Kamal! It's not urgent or necessary at all. I'm allready happy with the plugin as it is :) The new version is just great!

    So what about this issue the old ratings not showing?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.