Adriano Posted April 9, 2010 Report Share Posted April 9, 2010 Hi guys! I'm using: if ( $this->topic['topic_move_time'] <= time() ) { $this->DB->update( 'topics', array( 'forum_id' => $this->topic['topic_move_forum'] ), 'tid = '.$this->topic['tid'], true ); require_once( IPSLib::getAppDir('forums') . '/sources/classes/moderate.php' ); $moderatorLibrary = new moderatorLibrary( $this->registry ); $moderatorLibrary->rebuildTopic( $this->topic['tid'], false ); $moderatorLibrary->forumRecount( $this->topic['forum_id'] ); $moderatorLibrary->forumRecount( $this->topic['topic_move_forum'] ); $moderatorLibrary->statsRecount(); $this->DB->update( 'topics ', array( 'topic_move_time' => 0 ), 'tid = '.$this->topic['tid'], true ); } It's working. A topic is 'moved' to another forum in specif time. The only problem is that the source forum keeps showing last post info of that topic, which is in other forum now. The topic now is inside 'New Forum'. But it shows on last info of 'A Test Forum'. When I go to 'A Test Forum', the topic it's not there: StatsRecount: /** * Recount total topics and replies for site statistics * * @access public * @return boolean */ public function statsRecount() { $this->cache->rebuildCache( 'stats', 'global' ); return true; } For its definition, it won't update forum cache. When you empty a forum on Admin CP, it updates the cache. They use: //----------------------------------------- // Rebuild forum cache //----------------------------------------- $this->recacheForums(); But this function is uselless: /** * Recache the forums * * @access public * @return void * @deprecated We're moving away from forum cache **/ public function recacheForums() { //$this->registry->class_forums->updateForumCache(); } :huh: How to update that cache/last post info properly, since what I'm doing seems not to work ? :huh: Quote Link to comment Share on other sites More sharing options...
Management Michael Posted April 9, 2010 Management Report Share Posted April 9, 2010 The statsRecount function should only be rebuilding the total posts/topics that appear on the board index. It won't touch the last post info. The forumRecount function should be sufficient. Without seeing your entire code, I can only assume the forumRecount is not getting the forum ids to rebuild. Perhaps you can add a print test line in the forumRecount function to make sure it's getting the correct forum ids. Adriano and Breadfan 2 Quote Link to comment Share on other sites More sharing options...
Adriano Posted April 9, 2010 Author Report Share Posted April 9, 2010 Geez, you're right! After update, those two values has the same value: $moderatorLibrary->forumRecount( $this->topic['forum_id'] ); $moderatorLibrary->forumRecount( $this->topic['topic_move_forum'] ); Tks, solved! Quote Link to comment Share on other sites More sharing options...
MPFF Posted April 9, 2010 Report Share Posted April 9, 2010 if i was you after the topic has been moved select the last topic id from in the old forum and just do a simple update if you understand what im getting at Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.