I think it must be happening in the store_basic() function - I'm using beta 9.6 code, give or take a couple of SVN versions. Whenever a story is voted on, the comment count is put back to zero, and this happens every time. Does anyone (Ash, I'm looking at you here!) know why its being reset to zero, instead of just being updated with its current value?
Shouldnt the line - $link_comments = $this->comments; - be taking care of the comment count, as long as it is preceded by a read() function?
![]() |
| | LinkBack (1) | Thread Tools | Display Modes |
| |||
| Voting resets comment count to zero (b9.6) |
| |||
| Quote:
Here's what I suspect is happening: 1) In vote.php, it calls $link->read_basic(); 2) If you look at the read_basic() function, it sets a lot of the values, but not the comment count. if(($link = $db->get_row("SELECT link_author, link_status, link_randkey, link_category, link_date, link_votes, link_karma, link_published_date FROM " . table_links . " WHERE link_id = $id"))) { $this->author=$link->link_author; $this->votes=$link->link_votes; $this->karma=$link->link_karma; $this->status=$link->link_status; $this->randkey=$link->link_randkey; $this->category=$link->link_category; 3) vote.php later calls insert_vote $link->insert_vote($current_user->user_id, $value); 4) At the end of the insert_vote function, it calls store_basic: $this->store_basic(); 5) It looks like store_basic updates the comment count in the link record, but the link->comments values hadn't been read in read_basic(); $link_comments = $this->comments; $sql = "UPDATE " . table_links . " set `link_reports`=$link_reports, `link_comments`=$link_comments, link_author=$link_author, link_status='$link_status', link_randkey=$link_randkey, link_category=$link_category, link_modified=NULL, link_date=FROM_UNIXTIME($link_date), link_published_date=FROM_UNIXTIME($link_published_ date), link_votes=$link_votes, link_karma=$link_karma WHERE link_id=$this->id"; If this is indeed the culprit, the simplest solution is probably to add setting the comment count in the read_basic() function.
__________________ RankCommercials |
| |||
|
Please ban user raquebarshad due to spam! (Spam of this user used to be above my post) Last edited by tbones; 06-23-2007 at 02:03 PM.. |
| |||
|
@dystopia Quote:
|
| ||||
|
Yes. same question here. Do we just add that value to the read_basic function?
|
| |||
|
I'll go test it out, thanks for providing a possible solution! EDIT: good catch, it seems to work! Voted on a story with comments, and the count remained constance once comments were defined in read_basic() - to match with store_basic(). I've also added a similar line for the link_reports field, since it also seems to be updated in store_basic(). Last edited by Simon; 06-22-2007 at 08:00 PM.. |
| ||||
|
Simon, could you give us just a quick rundown (1,2,3) of what needs to be done to fix this bug. Thank you! |
| |||
|
1.) Open up libs/link.php, and find the function read_basic() 2.) There is a SELECT query, add in 2 more fields (link_comments & link_reports) 3.) Then add in 2 lines below that: $this->comments=$link->link_comments; $this->reports=$link->link_reports; That should mean that all fields that are updated in store_basic() are also defined in read_basic(). |
| The Following 4 Users Say Thank You to Simon For This Useful Post: | ||
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://forums.pligg.com/bug-report/7093-voting-resets-comment-count-zero-b9-6-a.html | ||||
| Posted By | For | Type | Date | |
| SourceForge.net Repository - [pligg] Log of /branches/9.x/libs/link.php | This thread | Refback | 07-04-2007 01:36 PM | |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 9.8.1 upgrade: comment count not showing up | nothingman | General Help | 2 | 02-21-2008 10:01 PM |
| Comment Count Update | Simon | Bug Report | 4 | 06-01-2007 09:45 PM |
| story comment count | daone | General Help | 0 | 03-06-2007 10:11 AM |
| How to move Vote count and Vote Label in voting box? | koltz | Template Support | 0 | 10-29-2006 08:39 PM |
| Fix comment voting in Safari for Mollio Beat & Paul01 | Sacha QS | Template Support | 1 | 10-24-2006 12:00 AM |






Linear Mode

