Ridding Yourself of Shadow Topics in phpBB

I’ll eventually write this into a modification, but phpBB moderators and administrators know that, when you move a topic, you’re given the option to create a “shadow topic”, one which will point users to the new topic. What’s not apparent is how to delete these shadow topics or how to have them expire.

It’s actually pretty simple: in phpbb_topics, there’s a field called “topic_moved_id”. When you move a topic and specify that a shadow topic be created, a new topic is added to the database. This topic then owns all the posts associated with the old topic, which becomes the “shadow topic”. The “topic_moved_id” field exists simply to let phpBB know the association between the topic and its shadow.

To remove the fields, all you have to is delete any topic_id that has a non-null topic_moved_id field. Now, the easiest way to do this would be DELETE FROM phpbb_topics WHERE topic_moved_id > 0;, but that deletes all the shadow topics. That’s decidedly not cool; I decided to leave the last 7-ish days of shadow topics.

So, I pulled up my handy-dandy UNIX timestamp converter, fed in 04 17 2005 00 00 00, and got 1113696000 as a timestamp. Working from there, the SQL query gets only marginally harder: DELETE FROM phpbb_topics WHERE topic_moved_id > 0 AND topic_time < 1113696000;. I executed that, and 748 shadow topics were gone from The Rumor Forum.

To turn this into a worthwhile phpBB modification, I just need to mimic how to put this in the Administration Panel in 2.0.x. I've got a couple modifications already installed that I can mimic, but for now, it's worth just posting this go-by for anyone else to use.


  1. Siacono: I agree, this would be a good option. As I am not administrating phpBB anymore, I can’t help you, but you might take the idea to the phpBB community boards’ Mods Forum and see if anyone is interested in coding it up.

  2. Thank you, GF! I was looking for how to delete shadow topics in the php-admin and didn’t find it – until I read your article now. So I managed the extra added topics phpbb_topics (I’m still using phpbb-version 2).

Comments are closed.