Support MemHT, Vote Now!
MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
     Site demo
Moderators: mem paulo89 adminik
RSSReply
FIX - Bug when deleting post
AuthorText
jhalls
Just arrived
Avatar

Posts: 9
Contributes: 9

Gender: _NEUTRAL_
Online: No
Date: 15/07/2008 01:29
FIX - Bug when deleting post
#post10004
I noticed a bug in pages/forum/index.php starting on line 1138 which deals with updating the last child field in the parent forum post. I am using version 3.8.5.

What I noticed when testing the system is that if there are only two posts and the second is deleted, the lastchild field is not updated appropriately. The lastchild field doesn't update and the value of the post deleted remains in that field, which in turn keeps the post from showing up in the thread list under the forum. The code I am reffering to is:

code
if ($row = $dblink->get_row("SELECT id FROM memht_forum_posts WHERE parent=$threadid ORDER BY id DESC LIMIT 1")) {
        $lastchild = intval($row['id']);
        $dblink->query("UPDATE memht_forum_posts SET lastchild='$lastchild' WHERE id=$threadid");
}


and the simple solution I came up with is this:
code
if ($row = $dblink->get_row("SELECT id FROM memht_forum_posts WHERE parent=$threadid ORDER BY id DESC LIMIT 1")) {
        $lastchild = intval($row['id']);
                                $dblink->query("UPDATE memht_forum_posts SET lastchild='$lastchild' WHERE id=$threadid");
} else if ($row = $dblink->get_row("SELECT id FROM memht_forum_posts WHERE id=$threadid ORDER BY id DESC LIMIT 1")) {
        $lastchild = intval($row['id']);
        $dblink->query("UPDATE memht_forum_posts SET lastchild='$lastchild' WHERE id=$threadid");
}


It simply states that when looking for the parent doesn't work, the parent must be the actual post.

I hope this helps in the MemHT development.
Edited: 15/07/2008 09:14
Delete Edit Quote
 
mem
MemHT's Dad
Admin / Developer

Avatar

Posts: 3984
Contributes: 1264

Gender: _MALE_
Online: Yes

Languages: English, Italian, Macedonian, Serbian
Date: 15/07/2008 09:12
Re: FIX - Bug when deleting post
#post10008
Tnx Smile
Image
MemHT Portal - Free PHP CMS and Blog

"Great works are performed, not by strength, but by perseverance."
Samuel Johnson

READ THIS before posting your support question in the forum!
Delete Edit Quote
 
jhalls
Just arrived
Avatar

Posts: 9
Contributes: 9

Gender: _NEUTRAL_
Online: No
Date: 15/07/2008 09:13
Re: FIX - Bug when deleting post
#post10010
No problem
Delete Edit Quote
 
Reply
Tags Cloud
Advertising
News Archive
Language
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.103.63.60

Username
Password
New files
MemHT Wiki
Friends
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo