The subroutine above is for updating boards, not for adding them.
Adding boards in done in the subroutine createBoard
sub createBoard{
my ($boardExists, $existingBoard, $membCat, $bname, $bpic, $bdescription, $bmoderators, $batt, $btopicperms, $bzero);
if($adminUseBlog){
$blogOwner = $_[0];
$blogDescription = $_[1];
$bpic = $_[2];
#Format the board id
$bname = $blogOwner;
$bname =~ s/\"/"/g;
&FromChars($bname);
#if no boards already exist with that id proceed
if (!exists $board{"$bname"}){
# the default category name
$membCat = $blogCatName;
#Only create a board file if one doesn't already exists
opendir(BOARDSDIR, $boardsdir);
$boardExists = "";
while ($existingBoard=readdir BOARDSDIR){
if($existingBoard =~ m/$bname/){
$boardExists = "on";
}
}
if(!$boardExists){
#create a new board file
fopen(BOARDINFO, ">$boardsdir/$bname".'.txt');
print BOARDINFO '';
fclose(BOARDINFO);
}
#else this was a deleted board of a returning member,
#so restore their existing blog messages
#set up for write to forum control
if (!($bpic =~ m!http://!)){
$bpic = "$facesurl/$bpic";
}
#format the description
$bdescription = $blogDescription;
$bdescription =~ s!\n!<br/>!g;
#get the administrators for this board
if($ownerIsAdmin){
$bmoderators = "admin, $blogOwner";
}
else{
$bmoderators = "admin";
}
#allow attachments
$batt = $allowAtt;
#only allow admin to create topics
$btopicperms = $topicPerms;
#make posts count towards total post count
$bzero = $postCount;
#add the new board to the start of the forum.control
my $newBoard = t|||\n";
push(@allboards, $bname);
@boardcntrl = &loadBoards('forum.control');
unshift(@boardcntrl, $newBoard);
&saveBoards(\@boardcntrl, 'forum.control');
&updateForumMaster($bname);
}#end if board exists
}#end if useBlog
}#end sub updateForumControl
This is the line that checks if the board exists
if (!exists $board{"$bname"}){
That lines checks the global boards array, which is already loaded into memory, for a board with the users name.
You might want to check that the first argument passed to this function is the actual member you are creating a board for, and not the current users username, as I did that earlier with $INFO{username}.
The next part
#Only create a board file if one doesn't already exists
opendir(BOARDSDIR, $boardsdir);
$boardExists = "";
while ($existingBoard=readdir BOARDSDIR){
if($existingBoard =~ m/$bname/){
$boardExists = "on";
}
}
checks the board directory for a board with the $bname, which is again the same 1st argument passed to the function. If no file with that name exists, create a file with that name.
The reason I didnt delete the board file when removing the board was so that if blog board was deleted and then restored again, the old messages where still in the restored board.
By looking at this subroutine I cannot see where how it duplicates the general board, but I think eliminating the extra spaces and using the correct username that we are creating a blog is a great start to finding the problem.
I will install a fresh board and try for myself once I find the time. Just busy with other projects and the moment, I hope I could point you in the right direction though.