[SOLVED] error integrating mibbit

Support for ANY phpBB3 related issue.
- MOD Support requests should be asked in the specific MOD topic -
Any version of phpBB3 is supported.
Forum rules
READ: StarTrekGuide.com Board Rules

Users are requested to fill out the Support Request Template and include it in every support request.

As a general rule, Support for a Specific MOD should be requested in the specific MOD topic, as it would alert the MOD Author of the support request.
Please specify if you have any MODs installed on your board when asking for support.

phpBB support requests allowed
MOD Requests and Generic discussions not allowed

[SOLVED] error integrating mibbit

Postby M-4 » 15 Jul 2012, 22:21

Greetings humans.

This unit is configuring a new phpBB3 board with mibbit.php: http://wiki.mibbit.com/index.php/PhpBB_integration#mibbit.php and in tests it throws this error:
Code: Select all
[phpBB Debug] PHP Notice: in file [ROOT]/mibbit.php on line 37: Undefined index: ircnick

A custom profile field was created via ACP for the IRC nickname (called ircnick, obviously).

Scanning functions_user.php (a mibbit.php include) and functions_profile_fields.php caused this unit's pseudo engrams to experience "a mass of conflicting impulses", as the unit Nomad would say (after that unit's unfortunate encounter with the unit Tan Ru, that is).
This unit cannot locate where 'ircnick' is or should be defined.

Mibbit loads error-free with the registered forum name in the login nick field if $userdata['username'] is used instead of $userdata['ircnick'].

Also, strangely, despite ACP settings to allow it, the IRC nick is not displayed in the post mini-profile block, but it is displayed in the main profile page. This unit's scans of HTML show no errors. :scratch:

The db appears good.

This unit requires assistance and has contacted mibbit support, who were as clueless as M units 1-3.

____
edit: This post was meant to go in the coding help forum (this unit is, afterall, "not entirely successful", so..oops)
Last edited by M-4 on 17 Jul 2012, 00:40, edited 1 time in total.
M-4
Crewman
Crewman
 
Posts: 2
Joined: 15 Jul 2012, 21:11
Gender: Male
phpBB Knowledge: 4




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: error integrating mibbit

Postby M-4 » 17 Jul 2012, 00:40

This unit has reasoned it out.
A check of the db revealed that phpBB prepends "pf_" to the custom profile name specified in the ACP when it inserts it into the phpbb_profile_fields_data table as a new column.

Once this unit got the syntax correct in the $sql variable and replaced wiki's is_valid_nickname($userdata['irc_nickname']) ? $userdata['irc_nickname'] as shown below, it worked:

Code: Select all
// Begin mibbit      
// Grab IRC nick
   $sql = 'SELECT pf_mibbit FROM ' . PROFILE_FIELDS_DATA_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . '';
   $result = $db->sql_query($sql);
   $nick = $db->sql_fetchfield('pf_mibbit');
   $db->sql_freeresult($result);
      
function is_valid_nick($nick)
{
   if($nick != '')
   {
      for($i = 0, $maxi = strlen($nick); $i < $maxi; $i++)
      {
         $code = ord($nick[$i]);
         if( !(($i > 0 && ( $code == 45 || ($code >= 48 && $code <= 57) )) || ($code >= 65 && $code <= 125)) ) break;
      }
      return ($i == $maxi);
   }
}

if($user->data['user_id'] != ANONYMOUS)
{
   $nick = is_valid_nick($nick) ? $nick : $user->data['username'];
}

else
{
   $nick = '';
}

if( !is_valid_nick($nick) )
{
   $nick = 'WebGuest_??';
}

$mibbit = 'http://widget.mibbit.com/?nick='.$nick
      .'&server=irc.anynet.org%3A6667'
      .'&noServerTab=false'
      .'&channel=%23anychan';

//Assign iframe src var
$template->assign_vars(array(
   'MIBBIT' => $mibbit,)
);
//End mibbit

The code above is in this unit's index.php because this unit has the mibbit iframe load automatically on initial site visit -- it is persistent, with the forum beneath it.
Ergo, in index.html:

Code: Select all
<div>
<iframe id="mibbit" class="mibbit" frameborder="0" width="95%" height="400" src="{MIBBIT}"></iframe>
</div>

Hope this proves useful...

Since mibbit loads automatically, a cookie will need to be created to fill the mibbit login field with a registered user's profiled IRC nick (or their forum name if the profile field is null). Guests get the default random treatment.
M-4
Crewman
Crewman
 
Posts: 2
Joined: 15 Jul 2012, 21:11
Gender: Male
phpBB Knowledge: 4


Return to phpBB3 Support

Who is online

Users browsing this forum: Baidu [spider], JikeSpider and 24 guests