All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: delete post ratings by user  (Read 1592 times)

0 Members and 1 Guest are viewing this topic.

Offline instinct

  • Newbie
  • *
  • Posts: 10
    • View Profile
delete post ratings by user
« on: 28 February 2009, 17:22 »
I've searched this forum and found that this is currently not possible without digging into the guts of the system and SQL, etc.

The problem starts with post authors being able to rate their own posts - authors create posts, then immediately vote 5 on it, so it skews the actual user ratings.

Now I'm stuck with trying to undo all the mess. I need a way to delete all comments by author and update the posts accordingly. Then if I had a way to prevent authors from voting on their own posts, this issue would stop completely.




Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: delete post ratings by user
« Reply #1 on: 28 February 2009, 17:36 »
It is not possible at the moment. You can query the logs by post id and user id, re-calculate it base on the query and then update the post meta again.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline instinct

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: delete post ratings by user
« Reply #2 on: 28 February 2009, 18:03 »
thanks - I may have a go at it, but I'm no SQL wiz - can always do it manually I guess - it's only 50-100 posts, lol


It is not possible at the moment. You can query the logs by post id and user id, re-calculate it base on the query and then update the post meta again.


Offline littaudio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: delete post ratings by user
« Reply #3 on: 30 March 2009, 12:22 »
For people interested in deleting more easily invalid ratings, here is a modified version of postratings-manager.php (V. 1.11), which allows to delete one particular rating (data & log) in one click.

Of course the average rating of the post concerned is automatically recalculated after deletion.

Enjoy !

Link 1 : http://dl.free.fr/vyF1XCv1T

or

Link 2 : http://www.litteratureaudio.com/postratings-manager.txt (in that case rename postratings-manager.txt in postratings-manager.php)

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: delete post ratings by user
« Reply #4 on: 30 March 2009, 13:16 »
Thanks for sharing, how about doing this for 1.50 beta? You can download it here http://downloads.wordpress.org/plugin/wp-postratings.zip

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline littaudio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: delete post ratings by user
« Reply #5 on: 30 March 2009, 23:18 »
Hello,

Thanks for the answer ! (and the plugin btw)

Answer to your question : that would be a pleasure, in a few days or weeks... (don't have the time right now, unfortunately)

But you know, if you look at the code, it should be easy & quick for you (you're a coder, and I'm really not ! and what's more it's your code, you don't have to guess the logic like me).

I've made five modifications, in fact based on the code that already existed : 1) lines 79-83 ; 2) lines 145-210 ; 3) line 355 ; 4) lines 397-403 ; 5) line 553.

NB. what I made is a "not-all-pretty-but-efficient" solution, it should be reviewed before "publication" I think.

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: delete post ratings by user
« Reply #6 on: 31 March 2009, 01:54 »
Thanks for the line modified, that would made it easier for me. I thought I would ask you as it might be easier for you to input the changes to the latest version then me as you know where the changes are but since you tell me the line modified, that is good enough for me =D

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline littaudio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: delete post ratings by user
« Reply #7 on: 31 March 2009, 20:30 »
You're welcome.

Just one more note to those interested in the adds I've made : to make the script work with your database, you've got to change its name lines 161, 167, 189 and 195 (I should have put `$wpdb->postmeta` instead of `wplitt_postmeta` each time).

Here are the new links :

Link 1 : http://dl.free.fr/vofu0yr97

or

Link 2 : http://www.litteratureaudio.com/postratings-manager.txt (in that case rename postratings-manager.txt in postratings-manager.php)

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: delete post ratings by user
« Reply #8 on: 01 April 2009, 02:39 »
Sure thing, I will take note of it, no worries, shall add it in when I have the time. lol

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Mainguy

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: delete post ratings by user
« Reply #9 on: 01 April 2009, 17:42 »
I think there is a mistake on line 27.

The code tries to load "postratings/postratings-manager_complet.php" which does not exist.

I believe it would be "wp-postratings/postratings-manager.php" I've tried it and it seems to work. But, the structure of the page is all messed.

I attached a screenshot of what it looks like.



[attachment deleted by admin]

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: delete post ratings by user
« Reply #10 on: 01 April 2009, 17:44 »
Do note that the "hack" is for postratings v1.11, and now it is postratings 1.40 so the "hack" will not work, you can't replace it line for line.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline littaudio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: delete post ratings by user
« Reply #11 on: 03 April 2009, 07:35 »
You're right Mainguy, another little thing I forgot to change.

(I did this change because my "hacked" page was called postratings-manager_complet.php - I kept the original one unmodified)

Will do the change on my links and on V1.40 as soon as possible.

Offline littaudio

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: delete post ratings by user
« Reply #12 on: 03 April 2009, 07:38 »
the structure of the page is all messed.

I attached a screenshot of what it looks like.


I think it is so because the stars don't load... please check in your page source the URL of the images.

Offline miccom

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: delete post ratings by user
« Reply #13 on: 11 May 2009, 12:09 »
Your modification uses as image path to the stars:
/wp-content/plugins/postratings/

The real path is:
/wp-content/plugins/wp-postratings/

So the stars are not loaded.

Offline uncleslam

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: delete post ratings by user
« Reply #14 on: 30 January 2010, 03:08 »
Does anyone have an updated version of littaudio's script that works with version 1.5?

If I'm not mistaken, the one on here is only for version 1.11 correct?