Work on the Drupal 6 port... need help
Views and CCK have both released Release Candidates for Drupal 6 and that means it's time to get the show on the road for the phpbb module. As I've said in another topic, I've been working on the problems identified in Drupal 6 conversion notes, but I need some help getting everything figured out.
I've figured out the two main issues identified in that topic...
a) "$phpbbcfg['allow_drupal_profiles'] is broken" because the variable was set to 'false' with the quotation marks and so php was treating it as a string.
b) "The menu link to private messages is broken" because the type was set to MENU_DYNAMIC_ITEM and that no longer exists in Drupal 6. Setting it to MENU_NORMAL_ITEM fixes the issue.
After fixing these two issues, however, I discovered a bigger issue. In the phpbb_menu() function, the global $user object is trashed. If you dump that variable you always get values for the drupal administrative user (user ID #1). I don't have a clue why this is happening and that's why I made this topic so hopefully we can get this issue resolved and move on since it seems like its the only thing standing in the way of a Drupal 6 release for this module.
I've narrowed down some of the possibilities for the origin of this problem. It doesn't seem to be an issue with the name of the $user object... I renamed all instances of a variable named $user that weren't being declared globally to $account and nothing changed.
I also decided to stick the Drupal 5 code for this module in a Drupal 6 installation, only changing the code for hook_menu, and see what would happen. The problem persisted, so I think the source of the issue is entirely something Drupal 6 related. Somewhere along the way the $user object is getting destroyed. I just don't know where. Any help would be greatly appreciated. I really want to get this module working for Drupal 6 ASAP.

Figured it out... almost
Drupal 6 now caches all hook_menu entries, and so the reason it was showing the $user object for the admin user is because that's the user that was available when the module was first installed. So it cached that value for everyone else. This can be proven if you clear the site cache with another user.
So it appears that hook_menu can't be used to display the number of new messages next to the Private Messages link. There are a few new hooks called hook_menu_alter and hook_menu_link_alter that are supposed to be used in situations like this. I've tried using both of these but neither seem to have any effect. The $user object still seems to be "stuck" on whoever either enabled the module or cleared the cache. Maybe I'm doing it wrong. I hope someone else can figure this out cause it's starting to drive me insane.
I think maybe we should just leave out the private menu link on the navigation menu and just have people use the "Forum details" block. That way people can get rid of the Private Messages link if they want to anyway.
Hi, thanks for all the
Hi, thanks for all the work.
I agree that sounds like a reasonable approach. I have looked a bit into whether we somehow sneak dynamic code into the menu cache, so that the menu is still cached (which makes a ton of sense), but the items executed.
Failing that, I agree it should be taken out and moved to a separate block.
No problem at all. I think
No problem at all. I think if you can live without shared avatars then the Drupal 6 module is ready to go (provided you've made the changes from the last build). I've poked at it quite a lot and everything seems to work just fine. All the sessions are synched just like they were in the Drupal 5 module. All the profile information is connected. Everything except that phpBB -> Drupal signatures don't work. Drupal -> phpBB do however. I think it's safe to start using live though. What do you think?
It sounds pretty good to me,
It sounds pretty good to me, I've used it on big sites long before it got here :)
Hello, congratulations to
Hello,
congratulations to your progress on the conversion, Achard. I was just hoping to include PHPbb to my 6.3 site and I wonder... is there a release (or release) candidate available somewhere? And if not, could you give us an estimate about when you intend to release it? I hope I don't sound rude - it's just that you said it was safe to start using live two weeks ago, and I got a bit impatient.
Thanks for your great work!
Jiri
I'm not the maintainer,
I'm not the maintainer, arkepp is. But I'll put up the package with my changes if that's ok with arkepp.
It's GPLv2, please do :) Can
It's GPLv2, please do :) I'm not sure I'm worthy of the title "maintainer" at this point, more like "founder".
Can also put it next to the existing stuff if you want, with proper references to you / your site.
Has this latest package been
Has this latest package been uploaded anywhere I can get it yet? I've been waiting for it to come out before I start playing around with Drupal, so I'm pretty anxious. :)
Latest Package
Here's the latest package that works with Drupal 6
http://www.gametabs.net/random/phpbb_drupal6.zip
@arkepp, my name is Richard Schaefer and my site is http://www.gametabs.net
Here's a full list of changes I made to it since SpectralDart's changes:
nice done archard! But i got
nice done archard! But i got a question: is the default user group bug fixed in the drupal 6 version? Cause i hate it to add the user in a other group and make that default and then make the normal user default...
edit: i also saw a big fault on the phpbb3 side of the mod:
in acp_users.php youre already including even before phpbb is defined!..
the correct code would be this:
find:
<?php/**
* @package acp
*/
?>
after add(new line):
<?php//include drupal
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(<strong>FILE</strong>, '.'), 1);
// The functions_drupal file is required.
include($phpbb_root_path . 'includes/functions_drupal.' . $phpEx);
?>
ps: dont add the php tags in the real code.
and i'm not sure if it needs to be "/forum/" or just "/"
more information:
This Tutorial Guide gives you a very basic overview of creating a new page to be integrated with the phpBB3 Framework. It is assumed that you have at least basic knowledge of PHP to perform this kind of integration.
This method is especially useful for creating pages that utilize the phpBB3 login function, and integration with your website or CMS.
http://code.phpbb.com/devwiki/Adding_pages
ps: the included files are still off version 3.0.0!
I'm not aware of a default
I'm not aware of a default user group bug... can you explain?
http://groups.drupal.org/node
http://groups.drupal.org/node/9657
the debug text:
the group ID is 51 and the users ar getting the right group ID but still i need to put them as the default group in the phpbb acp, you can reproduce the error:
1.
2.
3.
4.
5.
5.5 select all existing users and make the group default for them
ps: you already have the bug on youre board: http://img518.imageshack.us/img518/1710/bugab0.jpg
the user always gets the color of the user before it and not the color off the default registered group. this bug is still in the 5.x version but it seems its never fixed :(
module not showing up?
Hi,
I unzipped the phpbb in the /modules folder and installed it using the admin-section on my site.
But now I can't seem to find it whitin my settings?
It's probably me, but I've like looked everywhere.. Thought it supposed to be http://site/admin/settings/phpbb but nothing there.
grtz
I don't think this module
I don't think this module has a settings page. You can get to the phpbb bypass page at phpbb/bypass and the diagnostic at phpbb/diagnostic. I think that's all the Drupal pages it provides.
Also, I wanna say to anyone who's reading that I'm going to be moving away from phpBB and so I won't be working on this module anymore.
Thanks for update for Drupal
Thanks for update for Drupal 6!
I'm looking for updated installation instruction for this package, but can't find other than this: http://drupal.i1media.no/drupal+phpbb/.
I've install Drupal 6.6 and phpbb 3.0.2 and are trying to install the module (http://drupal.i1media.no/drupal+phpbb/install_module), but in the instructions say I need to run this in PHPmyAdmin:
UPDATE. And I can't finddatabasename.drupal_sequencesSETid= '1000' WHEREdrupal_sequences.name= 'drupal_users_uid' LIMIT 1 ;drupal_sequencesin Drupal table. What should I do now or had I miss something?EDIT: I found a solution (http://groups.drupal.org/node/9318), but now have I another problem. Proably I don't understand or find the right place to do it; I'm trying to give another user premisson as administrator in Drupal, but I can't find how to do that. I remember I did it in Drupal 5.x, but can't do the same way with Drupal 6.x.
Login / logout problems
Hi archard,
Thanks for your work on this module.
When trying this module I have found that I can't log out of the forum, I have to log out via drupal or I get page not found errors.
Also, if I try to log in directly to the forum I get page not found errors and can't log in.
This means I can't log in as the forum administrator because they are not a drupal user.
Is this normal behavior or have I done something wrong?
[EDIT]
I found a solution here - http://groups.drupal.org/node/8929
solved!
The problem is solved in the drupal 5.x version!
for the people with drupal 5 version:
open phpbb.module with youre favorite editor
find:
$gid = $row['group_id'];
After add(new line!):
//Get the group color, thx to Brf off phpbb.com for the fix!
$gcolor = $row['group_colour'];
find:
group_id,After add(in line):
user_colour,find:
$gid,
After add(in line!):
'$gcolor',
the full code needs to look like this without php tags:
<?php
// Get the group for registered users
$row = db_fetch_array(db_query("SELECT * FROM {$phpbbcfg['db_groups']} WHERE <code>group_name</code> = 'REGISTERED'"));
$gid = $row['group_id'];
//Get the group color, thx to Brf off phpbb.com for the fix!
$gcolor = $row['group_colour'];
// Insert a minimal user.
$query = "INSERT INTO {$phpbbcfg['db_users']} "
."(<code>user_id</code>,<code>group_id</code>,<code>user_colour</code>,<code>username</code>,<code>username_clean</code>,<code>user_password</code>,"
."<code>user_regdate</code>,<code>user_email</code>,<code>user_options</code>,<code>user_lang</code>,<code>user_timezone</code>,"
."<code>user_sig</code>,<code>user_lastpage</code>,<code>user_permissions</code>,<code>user_from</code>,<code>user_aim</code>,"
."<code>user_yim</code>,<code>user_msnm</code>,<code>user_jabber</code>,<code>user_website</code>,<code>user_occ</code>,"
."<code>user_interests</code>,<code>user_form_salt</code>,<code>user_email_hash</code>) "
." VALUES( "
." {$edit['uid']},$gid,'$gcolor','%s','%s','%s',"
.time() .",'%s','%s','$language',$timezone,"
."'','','','','',"
."'','','','','',"
."'','%s','%s')";
$res = db_query($query,$edit['name'],$clean_username,_phpbb_password_hash($edit['pass']),
$edit['mail'],$phpbbcfg['default_user_options'],_phpbb_random(),
crc32(strtolower($edit['mail'])).strlen($edit['mail']));
?>
A little fix
Thanks for the code demon326,
When using it though I was getting an sql error when creating users.
I have made a little change to the code that fixes the bug (namely, adding quotes as it is a varchar field and you get errors otherwise if it is an empty string):
<?php
// Get the group for registered users
$row = db_fetch_array(db_query("SELECT * FROM {$phpbbcfg['db_groups']} WHERE <code>group_name</code> = 'REGISTERED'"));
$gid = $row['group_id'];
//Get the group color, thx to Brf off phpbb.com for the fix!
$gcolour = $row['group_colour'];
// Insert a minimal user.
$query = "INSERT INTO {$phpbbcfg['db_users']} "
."(<code>user_id</code>,<code>group_id</code>,<code>user_colour</code>,<code>username</code>,<code>username_clean</code>,<code>user_password</code>,"
."<code>user_regdate</code>,<code>user_email</code>,<code>user_options</code>,<code>user_lang</code>,<code>user_timezone</code>,"
."<code>user_sig</code>,<code>user_lastpage</code>,<code>user_permissions</code>,<code>user_from</code>,<code>user_aim</code>,"
."<code>user_yim</code>,<code>user_msnm</code>,<code>user_jabber</code>,<code>user_website</code>,<code>user_occ</code>,"
."<code>user_interests</code>,<code>user_form_salt</code>,<code>user_email_hash</code>) "
." VALUES( "
." {$edit['uid']},$gid,'%s','%s','%s','%s',"
.time() .",'%s','%s','$language',$timezone,"
."'','','','','',"
."'','','','','',"
."'','%s','%s')";
$res = db_query($query,$gcolour,$edit['name'],$clean_username,_phpbb_password_hash($edit['pass']),
$edit['mail'],$phpbbcfg['default_user_options'],_phpbb_random(),
crc32(strtolower($edit['mail'])).strlen($edit['mail']));
?>
Thanks again.
I also have fully functioning picture/avatar synchronisation, which I will post soon when I finish working on the module.
News?
Hey,
Is there any news on the D6 version of the module?
Thanks,
Eric Aitala - f1m@f1m.com
Yes, I also wonder if you
Yes, I also wonder if you are still working on it. Big fan! ;)
But Eric, I think you can safely use the version archard posted a few post above. I'm using it and it works like a charm. Thank you, archard!
installing 6.X version, still use 5.X instructions?
In installing this 6.X version, should we still use (with the exception of the user sequence stuff) the 5.X instructions?
To the main page!
I can confirm this 6.x version works!
Perhaps someone should put it in the downloads folder (as 6.x-dev), so other people can see it? I keep reading questions by users who heard of the 6.x version but can't find it.
How's going the drupal 6.x porting status?
It seems archard done a good job by first porting phpbb module to drupal 6 but as he said he moved away from phpbb so he don't maintain this module anymore.
So, arkepp, what do you want to do now? Have you leaved this project too?
The main module page does not show anything about archard porting neither current 6.x dev status.
Are we users leaved alone?
same question, what is the
same question, what is the porting status for single sign on?
Updated version
Thanks for all the work on this so far.
I have made some more changes to the phpbb_drupal6.zip version in http://groups.drupal.org/node/12949#comment-43919
It has the following changes:
* The group colour change from http://groups.drupal.org/node/12949#comment-83404
* The users signature field syncs both ways now
* There is full 2-way avatar syncing
* There is some syncing of phpbb groups and drupal roles - It doesn't sync the creation/deletion of groups/roles but if you have a group on phpbb that has the same name as a role in drupal (case insensitive), when you add or remove users from groups/roles it is synced in both areas.
* I have added instructions to the INSTALL.TXT file
The file attached is a zip file that has been renamed so it could be uploaded.
Just rename it and remove the _.txt from the end.
Why no drupal project?
Also, why is this project just floating around out here instead of being on it's drupal (http://drupal.org/project/phpbb)?
If we put this version on it's project page we could get more people testing and providing patches to make this module better.
Ammendment to the updated version
There was a line of code that was commented for testing in the previous version (http://groups.drupal.org/node/12949#comment-83937)
This version has that line uncommented again, so use this one and not the last one.
Like the last on you just have to remove the _.txt from the file name.
Funded by
Sorry, forgot to mention.
Work on this was funded by pikos@drupal.org
Errors using ACP
Thanks for posting the link, I'm currently trying out this version. I'm surprised this isn't a drupal project as well, considering the number of people voicing their disappointment of the forum provided as part of drupal.
I followed the install instructions as best as I could, I had already installed drupal, but the rest of the install went well. The problem I encountered was only on logging into the phpbb admin account and trying to manage users. If I go into the ACP and click 'Manage users' under 'Quick Access' I get the following:
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 23: include_once(includes/file.inc) [function.include-once]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 23: include_once() [function.include]: Failed opening 'includes/file.inc' for inclusion (include_path='.:/usr/local/lib/php')
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 24: include_once(includes/bootstrap.inc) [function.include-once]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 24: include_once() [function.include]: Failed opening 'includes/bootstrap.inc' for inclusion (include_path='.:/usr/local/lib/php')
Fatal error: Call to undefined function drupal_bootstrap() in /mercury/www/html/test.psyberion.com/forum/includes/functions_drupal.php on line 25
Now, I have drupal installed in the root web directory for the domain name, with phpBB installed in a sub folder 'forum' as described in the install instructions for the module.
The section of code with line numbers from functions_drupal.php that this error relates to is:
22 chdir('./../');
23 include_once('includes/file.inc');
24 include_once('includes/bootstrap.inc');
25 drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
26 chdir('./forum/');
I'm not entirely sure at this point what the current directory is, whether it's the location of this 'functions_drupal.php' file, or the location of the top level php file, which in this case would be /drupal_dir/forum/adm/ because the browser has the index.php page from that directory loaded when the error occurs. If I remember correctly it's the latter? Either way, after the chdir on line 22, then the current folder would be /drupal_dir/forum so the references to includes/file.inc and include/bootstrap.inc are looking for these files in the phpBB includes folder, when they actually exist in the drupal includes folder.
But I'm wondering (without going through the whole drupal/phpbb integration module. If I change line 22 to chdir('./../../'); will it break functionality anywhere else? Because if it is how I imagine, that the current folder is the that of the loaded php file and not the included functions_drupal.php file. Then changing this might fix the problem whilst using the admin pages in phpBB, but break the rest of the phpBB pages.
Just to confirm, I did use the (drupal-directory)/phpbb/bypass page to login as the phpBB admin user.
Any help on this would be greatly appreciated.
Thank you.
I've just tried changing line 22 and I now get the following error:
General Error
Language file ./../language/en/posting.php couldn't be opened.
I'm not having as much luck tracing this error.
Bug fixed + new functionality
Hi David McMurray,
Bug fix:
I have made a change that should fix your problem.
Before it was such that you had to have your phpbb installed to your_drupal_dir/your_forum_dir (things like your_drupal_dir/dir/your_forum_dir wouldn't work properly).
I have changed it to use the script_path variable in phpbb's config so it should now work regardless of where it is installed.
New feature:
There is a settings page (admin/settings/phpbb - you need to have the administer phpbb permission to see it) where you can 'Enable user import from phpbb to drupal on log in', which means if you have existing users in phpbb that don't have drupal user accounts, when they try to log into drupal a drupal account will automatically be created from their phpbb one as they log in (seamless, no other steps required).
It will bring across profile data including signature and avatar as well as groups (still only if the group already exists in drupal as a role).
Hi Justin, Thank you for
Hi Justin,
Thank you for looking into the issue. The thing that puzzles me is that I installed phpBB in drupal_dir/forum_dir as you say it expects and as described in the install instructions for the phpBB-D6 module, so for example I access my forum with http://my.domain.com/forum.
I thought the issue would be because the ACP main page (my.domain.com/forum/adm/index.php) is one level deeper than the non-administration pages of the forum (eg. my.domain.com/forum/index.php) then the line to change directory to the drupal location (chdir('./../');) is only changing to the forum location. If I change it to chdir('./../../'); then I don't get the PHP errors I listed above when choosing the 'Manage users' menu option. But then I do get the following non-PHP error:
General Error
Language file ./../language/en/posting.php couldn't be opened.
Anyway, I'll give your new version a whirl and let you know.
Regards,
David.
Hi Justin, I just installed
Hi Justin,
I just installed the new version and gave it a whirl and I get the same errors, all that's different is the line numbers (30 and 31 instead of 22 and 23). Here are the errors:
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 30: include_once(includes/file.inc) [function.include-once]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 30: include_once() [function.include]: Failed opening 'includes/file.inc' for inclusion (include_path='.:/usr/local/lib/php')
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 31: include_once(includes/bootstrap.inc) [function.include-once]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /forum/includes/functions_drupal.php on line 31: include_once() [function.include]: Failed opening 'includes/bootstrap.inc' for inclusion (include_path='.:/usr/local/lib/php')
Fatal error: Call to undefined function drupal_bootstrap() in /mercury/www/html/test.psyberion.com/forum/includes/functions_drupal.php on line 32
I printed some details from this section of code and $forum_dir is 'forum', so $drupal_dir comes out as './../' which is effectively the same as before (chdir('./../');). If it's of any help I checked my configuration.inc.php file which I left as:
$phpbbcfg['path_rel'] = 'forum/';
$phpbbcfg['path_abs'] = '/forum/';
Which seems correct to me as the forum is installed and accessible from http://my.domain.com/forum
Regards,
David.
Thanks for the info
Yeah, those path_rel and path_abs values are correct.
I will have a look into this as soon as I get a bit of spare time and see if I can make it work properly.
Hopefully fixed
Here is a new version that hopefully fixes the issue. I have been able to partly test it but let me know if the problem still exists.
There is also another little bug fix in the phpbb.module file.
There was an old piece of code on line 422 that was calling the watchdog function incorrectly. That is now fixed.
If you are using the phpbb_d6_20090722.zip_.txt version it is only the phpbb.module and functions_drupal.php files that have changed.
A couple more fixes
I have had it confirmed that the previous version does fix the problem.
I have discovered though that all the calls to drupal's watchdog function were incorrect.
I have now fixed those as well as fixing the drupal_set_messages to be translatable.
There are also a couple of very minor changes to the INSTALL.txt file.
Yes, sorry... I had removed
Yes, sorry...
I had removed all the phpBB stuff, so i couldn't really test it again. I re-evaluated the built-in Drupal forum and related modules and decided to give it a whirl.
Thanks,
David.
Just Installed It And Was Wondering...
Is there a way when they log into the website that they auto login to phpBB too?
Thanks!
Chris
This is great Justin. I agree
This is great Justin. I agree with your above comment. This really needs to take over the existing phpbb module (http://drupal.org/project/phpbb). It took me quite a bit of digging to even find this post. Have you tried contacting the author of the existing module? If you don't get a response, you are able to take over the project via the abandoned modules process. Thanks again for porting this to 6.x.
Re:
I contacteed the maintainer a while ago when I was doing this work for a client and they gave a semi legitimate reason for not putting it on drupal.org.
I can't remember exactly what it was though.
Anyway, in my use i've found this module to be fairly buggy and a bit of a pain in the ass to add functionality to.
As well as that the fact there is no proper drupal.org project page means support and bug fixes are almost non-existent and hard to find if they do exist means I would not recommend this as a solution for people wanting to use phpbb.
Having no proper support means it will cause you problems in the future.
I haven't looked far into it but http://drupal.org/project/phpbbforum looks like a much better solution.
It is actively maintained and it has added many needed features since I last looked at it.
I'm also having trouble with
I'm also having trouble with displaying the forum within drupal. For instance if I create a menu item that points to the forum (http://my.domain.com/forum), when clicking on that link it loads the forum without the drupal theme and menus around it.
Are there any instructions for setting this up so that when the forum is in use the drupal theme and menu is still available?
I have different data bases
I have different data bases (drupaldb and db_name) and such problem:
user warning: Table 'drupaldb.db_namephpbb_config' doesn't exist query: SELECT * FROM db_namephpbb_config in /var/www/uzer/data/www/site.ru/sites/site.ru/modules/phpbb/phpbb.module on line 565.
user warning: Incorrect table name 'db_name.phpbb_banlist' query: DELETE FROM
db_name.phpbb_banlist' WHEREban_userid` = 8 in /var/www/uzer/data/www/site.ru/sites/site.ru/modules/phpbb/phpbb.module on line 271.What is the problem?
After changes in user profile in Drupal - error:
Query failed: 0 DELETE FROM
db_name.phpbb_banlistWHEREban_userid= 1