Skip to:
Content

bbPress.org


Ignore:
Timestamp:
03/01/2005 12:42:52 AM (20 years ago)
Author:
matt
Message:

Fixes #31

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-includes/functions.php

    r47 r56  
    378378        $bbdb->query("UPDATE $bbdb->posts SET post_status = 1 WHERE post_id = $post_id");
    379379        $bbdb->query("UPDATE $bbdb->forums SET posts = posts - 1 WHERE forum_id = $topic->forum_id");
    380         $bbdb->query("UPDATE $bbdb->topics SET topic_posts = topic_posts - 1 WHERE topic_id = $post->topic_id");
    381        
     380
     381        $old_post = $bbdb->get_row("SELECT post_id, poster_id, post_time FROM $bbdb->posts WHERE topic_id = $post->topic_id AND post_status = 0 ORDER BY post_time DESC LIMIT 1");
     382        $old_name = $bbdb->get_var("SELECT username FROM $bbdb->users WHERE user_id = $old_post->poster_id");
     383        $bbdb->query("UPDATE $bbdb->topics SET topic_time = '$old_post->post_time', topic_last_poster = $old_post->poster_id, topic_last_poster_name = '$old_name', topic_last_post_id = $old_post->post_id, topic_posts = topic_posts - 1 WHERE topic_id = $post->topic_id");
     384
    382385        if ( 0 == $bbdb->get_var("SELECT topic_posts FROM $bbdb->topics WHERE topic_id = $post->topic_id") )
    383386            $bbdb->query("UPDATE $bbdb->topics SET topic_status = 1 WHERE topic_id = $post->topic_id");
Note: See TracChangeset for help on using the changeset viewer.