viewtopic.php requires two Drupal files:

include_once 'includes/bootstrap.inc';
include_once 'includes/common.inc';

the include_once() should be replaced with requires().

the redirect will fail if the forum was not in the Drupal root directory.

The include should be changed to include the full path to the files.

For example:

include_once '/var/www/drupal/includes/bootstrap.inc';
include_once '/var/www/drupal/includes/common.inc';

Comments

beginner’s picture

I have just commited a quick fix to cvs, but a better long term solution could be found.
http://drupal.org/cvs?commit=30627

hadishon’s picture

I still get this error after updated to the new version and putting the full directory path:

Fatal error: Call to undefined function: db_result() in httpdocs/aliyahnet/viewtopic.php on line 12

I'm using 4.7 rc 3.

beginner’s picture

Hm. Download and use this version of viewtopic.php and adjust the path accordingly at the top.
If the path is not set properly, you'll have an error like:

Warning: main(includes/common.inc): failed to open stream: No such file or directory in ...

Adjust the path and it should work.

beginner’s picture

Oh! ok, sorry. I see your real problem, now. I'm investigating...

beginner’s picture

Here's the deal.
the new viewtopic.php should be placed within the drupal root directory otherwise Drupal is fooled and can't include the proper setting files. :/

If your phpBB installation was not in the root directory (say it was in a sub-directory called 'phpbb' and Drupal is in the root directory of your server), then you can create a simple .htaccess file that you can place in your phpbb sub-directory with the following content:

Redirect 301  /phpbb/viewtopic.php  http://127.0.0.1/viewtopic.php

Also, revert to relative path requires:

require_once 'includes/bootstrap.inc';
require_once 'includes/common.inc';

Does this work for you?

beginner’s picture

Actually, you can even place the redirect code above in your main Drupal .htaccess file, so that you can completely empty your phpbb/ directory and remove it.

beginner’s picture

Title: redirect doesn't work when viewtopic.php is not in Drupal root directory. » redirect incoming links from old phpBB to new Drupal forum
Status: Active » Fixed

The redirect is now handled by a new phpbb_redirect.module.

Anonymous’s picture

Status: Fixed » Closed (fixed)