Hi,

I'm working on my first Drupal project, and don't yet know how create patches :-/

But anyways, i'm currently importing a phpBB3 forum into drupal forum with the phpBB2Drupal module, and i'm doing som bugfixes.

First of i had troubles Signatures for forum module. The initial problem was that the signatures didn't go into the signatures_forum table, so i submittet a fix for that over here #594860

Second, the signatures were cut of, giving me incomplete signatures. Checking for the signatures module fixed that one.

Line 389

...
    if ($user->user_type <> 1 && !(isset($user->user_active))) {
      $user->user_active = 1;
    }

    // Signatures for Forums module supports longer values than default 255 chars
    // http://drupal.org/project/signature_forum
    if(!module_exists('signature_forum')) {
      $signature = substr($signature, 0, 255);
    }

    $data = array(
      'name' => substr($user->username, 0, 60),
      'pass' => $user->user_password,
      'mail' => substr($user->user_email, 0, 64),
      'signature' => $signature,
      'created' => $user_regdate,

...

Also access time was set to import time, this is because the core user module overrides it. Though it is stated in phpBB2Drupal module that the created time is overridden - It's the othe way around. But i didn't remove the created date, just added the access date.

Line 916

    //Drupal overrides the phpBB user registration date when creating a Drupal account.
    //so we need to update it here.
    $user = user_save($user, array('created' => $phpbb_user['created'], 'access' => $phpbb_user['access']));

And now to the attachements. I had some problems with the attachments, only 'orphan' attachments were imported and all orphans from the phpBB3 db, i my case 15, were added every time a post had an attachment, leaving out the correct attachments. And also after i fixed that one, all attachment added to the conversation ended up in the first post (topic post). So heres the fixes for both problems.

Line 648: Removed a $pre variable (orphans bug), and changed the query using $topic->topic_first_post_id (topic post bug)

    // Handle attachments
    if ($PHPBB2DRUPAL_IMPORT_ATTACHMENTS) {
      if ($topic->topic_attachment == 1) {

        db_set_active('default');
        $file_path = variable_get('file_directory_path', 'files');

        db_set_active('phpbb');
        $files = db_query('SELECT * FROM %sattachments a WHERE a.post_msg_id = %d', $pre, $topic->topic_first_post_id);

Line 806: Removed a $pre variable (orphans bug)

      // Handle attachments
      if ($PHPBB2DRUPAL_IMPORT_ATTACHMENTS) {
        if ($post->post_attachment == 1) {
          db_set_active('default');
          $file_path = variable_get('file_directory_path', 'files');

          db_set_active('phpbb');
          $files = db_query('SELECT * FROM %sattachments a WHERE a.post_msg_id = %d',
            $pre, $post->post_id);

Thats all for now, still get that user_stats UID error while importing post though.

Comments

Phliplip’s picture

Correct link to signatures fix #594860: Fix for use with phpBB2Drupal

Still new to this :P

Phliplip’s picture

Forget the access fix, i have misunderstood something and not tested properly

NaheemSays’s picture

Status: Active » Fixed

Thanks!

Committed those fixes to Head: http://drupal.org/cvs?commit=270706

Within a few hours a new head release will be rolled (Midnight GMT) from where you will be able to test these changes if you wish.

(I have not tested any, but the bugs were obvious and the fixes seemed sane)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

andypost’s picture

Category: bug » task
Status: Closed (fixed) » Needs review

Please add link http://drupal.org/project/signature_forum to modules page!

JeremyFrench’s picture

Status: Needs review » Closed (fixed)