Category: Web

phpBB3: In-Line Code

One of the best features that was added in phpBB3 when it came out was the ability to add custom BBCodes for use in forum posts. It made it possible to include abilities like text effects, embedding videos and other things without having to use mods. It’s one of the best features in phpBB, and it’s also one reason why I prefer it over competitors like SMF (which, as far as I know, don’t even have this ability in the upcoming 2.1 release).

If discussions in your board center around programming, it’s probably worthwhile to you for posters to have the ability to bring attention to certain words or characters in their posts, particularly related to code, without the need to isolate it inside of a <div> the way the standard BBCode block does. Fortunately, it's extremely easy to do.

Assuming you're familiar with the phpBB ACP, navigate to the POSTING -> BBCodes section, and select Add a new BBCode.

You can use whatever you wish for the actual BBCode, but I chose iCode to keep it relatively simple and similar to the standard Code BBCode option.

For the BBCode usage section, define the usage as shown (with the exception of using a different BBCode name):

[iCode]{TEXT}[/iCode]

Then under HTML replacement, put the following:

<code style="background-color:#FFF; color:#2E8B57; border:1px solid #C9D2D8; padding: 0 1px; font:0.9em/1.3em Monaco,'Andale Mono','Courier New',Courier,mono;">{TEXT}</code>

Lastly, define a help-line, if you wish to have one, and select whether or not you want the button for the BBCode displayed on the posting page. Then just hit Submit, and you're done!

Here is how the text placed within the BBCode will look in a post (using prosilver):

phpBB3 In-Line BBCode

If you're using a different style other than prosilver, it may be worthwhile to define CSS style elements inside the theme stylesheets for each style so that the in-line code will look different depending on the style your forum users are using. In that case, you would want to use something like the following for your HTML usage section for the BBCode:

<code class="inline-code">{TEXT}</code>

After all, it would be more appropriate for this BBCode to style text in the post to follow the way it does in the regular Code block, that way people know what they're looking at.

Just remember that text placed inside of custom BBCodes is still parsed the way all other text in the post is, and so using other BBCodes within this one will result in the effects of those other BBCodes still being applied rather than showing them in an un-parsed format the way the standard Code BBCode tag does.

phpBB 3.1: prosilver Forum Heights

I like some of the new additional features in the phpBB 3.1 branch, but I personally am not a big fan of the way forum tables are styled. In the 3.0 branch, I used a mod to display the last post subject on the board index, but this was a feature included in 3.1 by default. Whereas a lot of people seemed to hate how wide the last post column was in prosilver for 3.0, it worked out well for me, because it made sure I had plenty of space to accommodate the text for the post subject – as well as to include the poster’s name, moved to the line with the time-stamp, without having to break to a third line. That made it possible to keep the rows narrow and, in my opinion, more appealing.

Well, I’m admittedly not very educated when it comes to styling or using CSS, so I really couldn’t determine how to make the changes to the prosilver style in 3.1 to have the same width distribution as it had in 3.0. I didn’t want to blindly tinker too much either, just in case any changes I might make would create issue with other elements in the board’s style. But what I thought was worth doing, and should have been done by the style team anyway, was to just set a minimum height for the rows. The reason I think this is worth doing, and should have been done by the phpBB style team by default, is because it is extremely ugly, in my opinion, to see the typical narrow forum rows for forums that have no posts, and then see the expanded rows for the forums that do have post info. If nothing else, it should have been consistent.

I found that the height of forums that have posts in them tend to be 50px after accommodating for the subject, author and time-stamp. So, I simply made that small change to those forum table styles to make it so that they were always a minimum of 50px in height. The colours.css file in the style’s theme folder is the one that holds these settings.

If you want to make this change, just open colours.css and find the following lines:

.forum_link			{ background-image: url("./images/forum_link.gif"); }
.forum_read			{ background-image: url("./images/forum_read.gif"); }
.forum_read_locked		{ background-image: url("./images/forum_read_locked.gif"); }
.forum_read_subforum		{ background-image: url("./images/forum_read_subforum.gif"); }
.forum_unread			{ background-image: url("./images/forum_unread.gif"); }
.forum_unread_locked		{ background-image: url("./images/forum_unread_locked.gif"); }
.forum_unread_subforum		{ background-image: url("./images/forum_unread_subforum.gif"); }

And just define a minimum height for each one with min-height: 50px;.

.forum_link			{ background-image: url("./images/forum_link.gif"); min-height: 50px; }
.forum_read			{ background-image: url("./images/forum_read.gif"); min-height: 50px; }
.forum_read_locked		{ background-image: url("./images/forum_read_locked.gif"); min-height: 50px; }
.forum_read_subforum		{ background-image: url("./images/forum_read_subforum.gif"); min-height: 50px; }
.forum_unread			{ background-image: url("./images/forum_unread.gif"); min-height: 50px; }
.forum_unread_locked		{ background-image: url("./images/forum_unread_locked.gif"); min-height: 50px; }
.forum_unread_subforum		{ background-image: url("./images/forum_unread_subforum.gif"); min-height: 50px; }

Now all rows displaying forum names and post information will have the same height, whether they have a post to display information for or not.

Note that you may have to purge your forum’s cache from the ACP after making the changes.

phpBB 3.1.x: Soft Delete for Boards Upgraded from 3.0.x

phpBB 3.1.x boards now have the ability to allow moderators to soft-delete posts so that they can later review the post and/or decide to restore it. If you upgraded from 3.0.x to 3.1.x instead of just installing a fresh 3.1.x board, you might have noticed that the confirmation message when deleting a post or thread doesn’t mention anything about soft- or hard-deletion. To fix the issue, all you have to do is modify some permissions that appear to be improperly set for the moderator roles in the permissions settings on the board during the upgrade.

The steps to fixing the issue are:

  • Go to your ACP.
  • Click on the Permissions tab.
  • Click on Moderator roles under the Permission Roles category in the left navigation pane.
  • Click the green edit cog icon to the right of the Full Moderator role.
  • Scroll down to the Moderative permissions section of the page.
  • Click on the Misc tab.
  • Change the Can soft delete posts entry from No to Yes.
  • Click Submit.

Anyone who has Global Moderator status on your board will now be able to soft delete posts as opposed to only being able to permanently delete them. The same must be done for any other moderator levels you want to be able to do soft-deletion as well. The Queue Moderator role doesn’t need the ability to perform any deletions – per its role description (only validating and editing posts queued for moderation), but you may decide you want the Standard and Simple moderator roles to only be able to soft-delete, whereas they can only hard-delete posts and topics due to the permissions issue of the upgrade. By default (in a fresh 3.1.x installation), the Standard, Simple and Full moderator roles are supposed to all be able to perform soft- and hard-delete on posts and topics.

phpFreeChat and MyBB: User/Group Identifying

I’ve already posted blogs on both my way of configuring phpFreeChat to authenticate users based on multiple groups in phpBB3, as well as identifying users and authenticating based on their groups in SMF 2.x.

Well, I’ve also posted up a sample phpFreeChat configuration for identifying and authenticating users based on groups in MyBB 1.6.x. Believe it or not, this was the most difficult of the three to get working – and that was thanks to MyBB’s extremely lacking documentation on its functions. If you decide to use my example, you’ll see that I also include some conditions, such as keeping the phpFreeChat configuration file (the file your chatters access to open phpFreeChat) within the MyBB directory. This isn’t really a big deal, however, because you can place these files anywhere outside of phpFreeChat’s installation directory and simply point them to it when loading the chat application. In fact, this actually caused me to stop pointing to my phpFreeChat directory from phpBB and SMF, and instead follow suit and starting placing the php files that held the configurations for them within the board directories as well.

But the point is that using MyBB required me to do this. I did, however, have a separate configuration arrangement with MyBB that may have contributed to the problem. My structure for MyBB was domain.com/forums/mybb/ – but I had the forums accessed at domain.com/forums/ – mirroring the mybb directory to the forums parent directory – which also required some particular settings in MyBB’s configuration for paths and what-not. I don’t know if this could be the reason that querying user information from MyBB required the file that was doing it to be in the MyBB directory or not, and I didn’t want to bother re-installing MyBB just to test it. If anyone else does and notices a difference, feel free to share your experiences. Either way, I hope the example configuration I’ve posted helps someone else who might be trying to query MyBB user info and group assignment for other purposes outside of MyBB itself.

phpBB3: Last Post Subject on Board Index

This is a modification you can find easily in the Knowledge Base section on the phpBB website. However, I have made some slight alterations to the template edit, as well as increased the number of characters allowed for the subject to be displayed. Keep in mind that I only use proSilver-based styles, and so the smaller 10-character limit is more suitable for subSilber-based styles. On top of that, the difference in template changes are specifically for proSilver-based styles as well, and would not work for subSilver.

A sample of how the subject will look on the board index.phpBB3: Last Post Subject on Board Index

The link to the original mod article is here.

#
#—-[ OPEN ]———————————————————–
#

includes/functions_display.php

#
#—-[ FIND ]———————————————————–
#

			'LAST_POST_SUBJECT'		=> censor_text($last_post_subject),

#
#—-[ REPLACE WITH ]—————————————————
#

			'LAST_POST_SUBJECT'		=> (utf8_strlen(censor_text($last_post_subject)) > 30) ? utf8_substr(censor_text($last_post_subject), 0, 30) . '...' : censor_text($last_post_subject),

#
#—-[ OPEN ]———————————————————–
#

styles/prosilver/template/forumlist_body.html

#
#—-[ FIND ]———————————————————–
#

						<!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF -->
						<!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn> {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}
						<!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<br />&nbsp;<!-- ENDIF --></span>

#
#—-[ REPLACE WITH ]—————————————————
#

						<!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF -->
						<!-- IF forumrow.LAST_POST_TIME --><a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_SUBJECT}</a><dfn>{L_LAST_POST}</dfn>
						<br />{forumrow.LAST_POST_TIME} {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}
						<!-- ELSE -->{L_NO_POSTS}<br />&nbsp;<!-- ENDIF --></span>

phpBB3: Auto-Resize Avatar

It makes no sense to me why the phpBB developers haven’t already included this functionality in phpBB by default, as the SMF board developers have done. But one great thing about SMF over phpBB is that after installing, you can simply set the dimension requirements for avatars and users who attempt to use larger images have those images resized to within the boundaries set on the board. Well, there is a mod for phpBB that allows it to do the same thing. Though the mod is listed as abandoned on the phpBB mod database, the mod still works well.

The mod was put together by Michal Poltyn. I have simply adjusted tabs and spaces to make the code more presentable to fit more neatly in the phpBB functions that are edited.

#
#—-[ OPEN ]———————————————————–
#

includes/function_upload.php

#
#—-[ FIND ]———————————————————–
#

		if (!$this->upload->valid_dimensions($this))
		{
				$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, //$this->upload->max_height, $this->width, $this->height);

			return false;
		}
		return true;
	}

#
#—-[ REPLACE WITH ]—————————————————
#

		if (!$this->upload->valid_dimensions($this))
   		{
      			$valid = $this->create_thumb();
      			if (!$valid)
      			{
         			$this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, $this->upload->max_height, $this->width, $this->height);
         			return false;
      			}
   		}

   		return true;
	}

	/**
	* Create a thumb if uploaded image is too big.
	* This function was based mainly on MediaWiki's thumbnail creating process
	* and create_thumbnail function in functions_posting.php
	* @source MediaWiki
	*/
	function create_thumb()
	{
   		global $config;

   		if ($this->width > $this->height) 
   		{
      			$thumb_width = $this->upload->max_width;
      			$thumb_height = $this->height*($this->upload->max_height/$this->width);
   		}
   		else if ($this->width < $this->height) 
   		{
      			$thumb_width = $this->width*($this->upload->max_width/$this->height);
      			$thumb_height = $this->upload->max_height;
   		}
   		else /* $this->width == $this->height */
   		{
      			$thumb_width = $this->upload->max_width;
      			$thumb_height = $this->upload->max_height;
   		}

   		// Only use imagemagick if defined and the passthru function not disabled
   		if ($config['img_imagick'] && function_exists('passthru'))
   		{
      			$quality = '';
      			$sharpen = '';
      			$frame = '';
      			$animation = '';
      			if ( $this->mimetype == 'image/jpeg' )
      			{
         			$quality = '-quality 80'; // 80%
         			/** Reduction in linear dimensions below which sharpening will be enabled */
         			if ( ( $thumb_width + $thumb_height ) / ( $this->width + $this->height ) < 0.85 )
         			{
            				$sharpen = '-sharpen 0x0.4';
         			}
      			}
      			else if ($this->mimetype == 'image/png')
      			{
         			$quality = '-quality 95'; // zlib 9, adaptive filtering
      			}
      			else if ($this->mimetype == 'image/gif')
      			{
         			/**
          			* Force thumbnailing of animated GIFs above this size to a single
          			* frame instead of an animated thumbnail. ImageMagick seems to
          			* get real unhappy and doesn't play well with resource limits. 
          			* Defaulting to 1 megapixel (1000x1000)
          			*/
         			if($this->width * $this->height > 1.0e6)
         			{
            				// Extract initial frame only
            				$frame = '[0]';
         			}
         			else
         			{
            				// Coalesce is needed to scale animated GIFs properly (MediaWiki bug 1017).
            				$animation = ' -coalesce ';
         			}
      			}
      			# Specify white background color, will be used for transparent images
      			# in Internet Explorer/Windows instead of default black.

      			# Note, we specify "-size {$this->width}" and NOT "-size {$this->width}x{$this->height}".
      			# It seems that ImageMagick has a bug wherein it produces thumbnails of
      			# the wrong size in the second case.

      			if (substr($config['img_imagick'], -1) !== '/')
      			{
         			$config['img_imagick'] .= '/';
      			}
      			$cmd  = 
         			escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') .
         			" {$quality} -background white -size {$this->width} ".
         			escapeshellarg($this->destination_file . $frame) .
         			$animation .
         			// For the -resize option a "!" is needed to force exact size,
         			// or ImageMagick may decide your ratio is wrong and slice off
         			// a pixel.
         			' -thumbnail ' . escapeshellarg( "{$thumb_width}x{$thumb_height}!" ) .
         			" -depth 8 $sharpen " .
         			escapeshellarg($this->destination_file) . ' 2>&1';

      			@passthru($cmd);

      			// after converting let's check the file dimensions again
      			if (($this->image_info = @getimagesize($this->destination_file)) !== false)
      			{
         			$this->width = $this->image_info[0]; // the _real_ width
         			$this->height = $this->image_info[1]; // the _real_ height
         			if ($this->upload->valid_dimensions($this)) 
         			{
            				return true;
         			}
      			}
   		}
   		if (extension_loaded('gd'))
   		{
      			/* This code is greatly based on MediaWiki's thumbnail generation process */
      			$typemap = array(
         			'image/gif'          => array( 'imagecreatefromgif',  'palette',   'imagegif'  ),
         			'image/jpeg'         => array( 'imagecreatefromjpeg', 'truecolor', array( __CLASS__, 'imagejpegwrapper' ) ),
         			'image/png'          => array( 'imagecreatefrompng',  'bits',      'imagepng'  ),
         			'image/vnd.wap.wbmp' => array( 'imagecreatefromwbmp', 'palette',   'imagewbmp'  ),
         			'image/xbm'          => array( 'imagecreatefromxbm',  'palette',   'imagexbm'  ),
      			);
      			if (!isset( $typemap[$this->mimetype] ))
      			{
         			return false;
      			}

      			list($loader, $color_style, $save_type) = $typemap[$this->mimetype];

      			if (!function_exists($loader))
      			{
         			return false;
      			}
      			$src_image = call_user_func( $loader, $this->destination_file );
      			$thumb = imagecreatetruecolor($thumb_width, $thumb_height);

      			// Initialise the destination image to transparent instead of
      			// the default solid black, to support PNG and GIF transparency nicely
      			$background = imagecolorallocate( $thumb, 0, 0, 0 );
      			imagecolortransparent( $thumb, $background );
      			imagealphablending( $thumb, false );

      			if( $color_style == 'palette' ) {
         			// Don't resample for paletted GIF images.
         			// It may just uglify them, and completely breaks transparency.
         			imagecopyresized( $thumb, $src_image,
            			0,0,0,0,
            			$thumb_width, $thumb_height, $this->width, $this->height );
      			} else {
         			imagecopyresampled( $thumb, $src_image,
            			0,0,0,0,
            			$thumb_width, $thumb_height, $this->width, $this->height );
      			}

			imagesavealpha( $thumb, true );

      			call_user_func( $save_type, $thumb, $this->destination_file );
      			imagedestroy($thumb);
      			imagedestroy($src_image);
      			$this->width = $thumb_width;
      			$this->height = $thumb_height;
      			return true;
   		}
   		return false;
	}

	static function imagejpegwrapper( $dst_image, $thumb_path ) {
   		imageinterlace( $dst_image );
   		imagejpeg( $dst_image, $thumb_path, 95 );
	}

 

phpFreeChat and SMF: User/Group Identifying

This post is a follow-up to a previous post I made regarding an (in my opinion) improved method of identifying users to be in certain groups for phpFreeChat when using user info from phpBB3 boards.

After doing some searching, I noticed that there wasn’t very much info about identifying users in phpFreeChat with SMF boards. At least not SMF 2.x. Maybe I missed something in my search. I don’t know. But I decided to use what I already had put together from getting user info in phpBB3 to help lead in the direction I needed to go – along with some tutorial info that the SMF guys have posted on the site for using the SSI stuff.

Surprisingly, the process of identifying someone to be logged into SMF and to be within a group (such as the Administrator group) was just as simple as what was used for phpBB.

First of all, you have to define the path to SMF’s SSI.php file and call it.

require_once('../forums/SSI.php');

In my case, I have my structure set up so that my chat and forums are within two separate sub-directories on my domain. Some people decide to place phpFreeChat on the domain as a sub-directory of their board’s directory.

Similar to what I did with my phpBB configuration, I decided to use a variable to alter whether or not guests could access the chat or be redirected to a login page.

$RequireLogin = false; // if true, will require chatter to be logged in on the SMF board
if ($context['user']['is_guest'])
{
	if($RequireLogin)
	{
		ssi_login();
		die();
	}
}

Either way, if the user isn’t a guest, we assign their SMF name as their phpFreeChat name.

if (!$context['user']['is_guest']) $params["nick"] = $user_info['name']; // SMF nick used

Lastly, we assign the board admin as administrator, along with anyone who is a member of any designated groups (based on group ID – as with the phpBB setup). In this step, I’m kind of being tedious (because the ‘is_admin’ and group 1 should both be returned true if the user is in the Administrator group), but it doesn’t cause any issues from what I’ve seen – and I feel it guarantees a board admin will be given admin authority in the chat, but you can leave out the group ID 1 if you wish.

// SMF groups:
// 1 = Administrator
// 2 = Global Moderator

if($context['user']['is_admin'])
{
	$params["isadmin"] = true;
}
else
{
	$allowed_groups = array(1, 2);
	foreach ($allowed_groups as $allowed)
	{
		if (in_array($allowed, $user_info['groups']))
		{
			$params["isadmin"] = true;
		}
	}
}

That’s all. 🙂

phpFreeChat and phpBB3: Better Group Identifying

When comparing all of the free or open-source software available for providing chat on a website that I have seen so far, I have personally found phpFreeChat to be one of the more impressive options. Though a new version is in the works (2.x), the first branch (1.x) is the most stable and contains the most features as of this moment.

Of those features:

  • the ability for anyone to create rooms (if enabled)
  • op status for administrating, as well as the ability to identify chatters by their credentials from various other site software (such as phpBB)
  • an assortment of theme options that are included, as well as the ability to customize with your own
  • private messaging

I don’t need to explain a great deal about phpFreeChat. You can learn almost anything you need to know about it from its official website and forums. However, what I did not find there and thought useful is a better way to identify chatters for granting op status based on their phpBB group(s). I typically use phpBB as a board in most scenarios.

Here is a copy of the basic chat setup from the phpFreeChat website for integrating with phpBB and using its user information for chatters:

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if ($user->data['user_id'] == ANONYMOUS)
{
	login_box('', $user->lang['LOGIN']);
}
?>
<?php

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Quick chat";
$params["nick"] = $user->data['username_clean']; 
$params['firstisadmin'] = false;
if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators
{
$params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate 😉
}

$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
$chat = new phpFreeChat( $params );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Chicken Talk Chat Room</title>  
 </head>
 <body>
<div class="content">
  <?php $chat->printChat(); ?>
</div>

</body></html>

I have highlighted the lines that grant op status based on the user’s board group.

The method I now use was found by searching the phpBB boards for a way to determine whether a user is in a particular group. You may think this is what is already done in the phpFreeChat example of using phpBB to identify chatters to grant op status above, but what is actually being done there is the chat script is determining if one of the groups being checked is the user’s primary group. Because group assignment is an important way to identify a board user’s main role, it is not uncommon for users to be in multiple groups so that they can access multiple functions. For example, a particular user may be a board administrator, but his primary group is support – because that is his main function on the board. In this case, in order for the user to get op status in the chat, you would have to have the check be looking for the support group, because that is the group ID that will be seen here since it is the user’s primary group. Even though the admin group is being checked, only one group ID is being passed for the user in this case, and it is the user’s primary group only.

For the method that I prefer, follow these steps:

  1. Require the includes/functions_user.php file.
    Find: 

    require($phpbb_root_path . 'common.' . $phpEx);

    and add the following after it:

    require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
  2. Use the group_memberships() function to identify an array of all of the user’s assigned groups.
    Find: 

    if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators
    {
    $params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate 😉
    }

    and replace it with the following:

    if (group_memberships(array(4,5),$user->data['user_id'],true))
    {
       $params["isadmin"] = true; // Do what you want cause a pirate is free, you are a pirate 😉
    }

As that example is now, it is still only checking for the Administrator and Global moderator groups. However, you can add a group ID to the array within the parentheses and it will check for that group as well. Unlike the original method, this check will pass so long as the user is within one of the listed groups – not requiring the group to be the user’s primary group.

Also, if you wish to not require chatters to be registered and logged in on your board, you can do the following to allow guest chatting:

  1. Find:
    if ($user->data['user_id'] == ANONYMOUS)
    {
    	login_box('', $user->lang['LOGIN']);
    }

    and replace it with the following:

    $RequireLogin = false; // if true, will require chatter to be logged in on the phpBB board 
    if ($user->data['user_id'] == ANONYMOUS)
    {
       if($RequireLogin)
       {
          login_box('', $user->lang['LOGIN']);
       }
    }

    Changing $RequireLogin to true will allow you to quickly revert back to requiring registeration and login without having to replace code again.

  2. Find:
    $params["nick"] = $user->data['username_clean'];

    and replace it with the following:

    if ($user->data['user_id'] != ANONYMOUS) $params["nick"] = $user->data['username_clean']; // phpBB nick used

    If this isn’t done and the $RequireLogin variable is set to false, the guest will be given the nick ANONYMOUS. Otherwise, they are either prompted for a nick upon loading the chat or given a randomly generated guest nick – depending on your phpFreeChat configuration for that.