Reply To: I want to get the parent forum name/ID of any topic
ok, without getting heavily involved in coding a solution for you (which is my paid day job 🙂 ) I guess that you have hooked to ‘template redirect’ which fires on everypage, so when WordPress displays the test-page it looks again for a value of topic_id, which on the test page does not exist, so returns zero.
if your code is working in that it redirects to test page, then you could try appending the topic id and picking that up in $_REQUEST
eg (untested)
wp_redirect('/test-page/?topic_id='.bbp_get_topic_id());
and then on test page use the code
if (isset($_REQUEST['topic_id'])) $topic_id = $_REQUEST('topic_id') ;