YaBB2.1 -> SMF membergroups problem

Started by JimUSFSig, May 13, 2007, 12:44:10 PM

Previous topic - Next topic

JimUSFSig

We're having a problem converting the membergroups from a YaBB 2.1 forum to SMF...

First, in the yabb21_to_smf.php file ...

Quoteforeach ($groups as $i => $group)
{
if (preg_match('~^\$Group\{\'(Administrator|Global Moderator|Moderator)\'\} = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~', $group, $match) != 0)
{
$match = addslashes_recursive($match);
$ID_GROUP = $match[1] == 'Administrator' ? 1 : ($match[1] == 'Global Moderator' ? 2 : 3);
$knownGroups[] = "$ID_GROUP, SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), '-1', SUBSTRING('$match[3]#$match[4]', 1, 255)";
}
elseif (preg_match('~\$Post\{\'(\d+)\'\} = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~', $group, $match) != 0)
{
$match = addslashes_recursive($match);
$extraGroups[] = "SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), " . max(0, $match[3]) . ", SUBSTRING('$match[3]#$match[4]', 1, 255)";

if ($match[3] < 1)
$newbie = true;
}
elseif (preg_match('~NoPost\(\'(\d+)\'\) = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~', $group, $match) != 0)
{
$match = addslashes_recursive($match);
$extraGroups[] = "SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), 0, SUBSTRING('$match[3]#$match[4]', 1, 255)";
}
}

Notice this line:
elseif (preg_match('~NoPost\(\'(\d+)\'\) = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~', $group, $match) != 0)

The parenthesis in bold above should be brackets { and } ... (the other if statements have the brackets.)  I made the change in the file, and now the member groups convert over -- but the board ID #s don't convert correctly.

I actually added a new column to the _membergroups table called "old_group_ids" that read the YaBB id#s... so we can match those #s up with the members later.

I actually had to add a new array for $otherGroups (as opposed to $knownGroups and $extraGroups) to make all of this work.


Next, the convert members script was not looking for the additional groups line in the YaBB member ".vars" files.  I added two line to read that additional groups ... one for the data[] array and one for the row[] array.

Now the code reads the correct additional groups for each member - using the old YaBB ID#s.

I then created a script file that would compare the _members.additionalGroups column with the _membergroups.old_group_id column I created.  It would then change the _members column to use the correct _membergroups.ID_GROUP numbers.


But the problem we are facing is that the member profiles don't show them as members of these additional membergroups... and the membergroups don't show them as members...


Does anyone have any idea how to fix this??


JimUSFSig

Okay. I figured out the problem.

The conversion script sets the minPosts = 0 for "regular" groups... but the SMF code, when trying to count members looks for minPosts = -1.

Another typo in the conversion script.

I still need to use the "fix-groups" file that I have created to re-assign the additionalGroups column of the _members table... but it seems like everything is working.


Advertisement: