Work on the Drupal 6 port... need help

public
group: phpbb
archard - Sun, 2008-07-06 23:08

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

archard - Mon, 2008-07-07 03:56

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

arkepp@drupal.org - Mon, 2008-07-07 12:18

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

archard - Mon, 2008-07-07 19:13

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,

arkepp@drupal.org - Thu, 2008-07-17 01:37

It sounds pretty good to me, I've used it on big sites long before it got here :)

Hello, congratulations to

markus_cz - Sat, 2008-07-19 18:37

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,

archard - Sat, 2008-07-19 21:42

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

arkepp@drupal.org - Sat, 2008-07-19 21:52

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

valionx - Sun, 2008-07-27 01:29

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

archard - Sun, 2008-07-27 02:32

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:

  • changed $phpbbcfg['allow_drupal_profiles'] to FALSE instead of 'false'
  • removed private message counter menu entry in favor of the Forum Stuff block
  • renamed phpbb_view to phpbb_page so it doesn't possibly interfere with hook_view in the future
  • made the code more readable and made it conform to Drupal's coding guidelines
  • removed everything related to $phpbbcfg['i1'] since it didn't seem to be of any use anywhere in the module
  • inserted a check for the latest user in _phpbb_user_update to make sure the newest username config variable would get updated in phpbb if the user changes their username in Drupal (phpbb.module line 156)

nice done archard! But i got

demon326@drupal.org - Sun, 2008-07-27 14:56

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

archard - Sun, 2008-07-27 18:42

I'm not aware of a default user group bug... can you explain?

http://groups.drupal.org/node

demon326@drupal.org - Sun, 2008-07-27 18:59

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.

  go to the ACP from phpbb 3

2.

  go to users an groupes

3.

  on the left select group mangement

4.

  select the "registered user" group and click on settings

5.

  give the group a color lets say yellow or so

5.5 select all existing users and make the group default for them

  1. make a new user and you will see he wont get the color

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?

zuzuzzzip - Thu, 2008-08-28 15:30

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

archard - Thu, 2008-08-28 17:57

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

xagits - Tue, 2008-11-18 12:09

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 databasename.drupal_sequences SET id = '1000' WHERE drupal_sequences.name = 'drupal_users_uid' LIMIT 1 ;. And I can't find drupal_sequences in 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.

solved!

demon326@drupal.org - Sun, 2008-08-03 20:38

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']));
?>

News?

aitala@drupal.org's picture
aitala@drupal.org - Mon, 2008-10-06 15:17

Hey,

Is there any news on the D6 version of the module?

Thanks,

Eric Aitala - f1m@f1m.com


Yes, I also wonder if you

markus_cz - Sat, 2008-10-18 16:47

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!