Take THAT, Africa...!
  

  

Welcome to 
Jimbo's World
home of the infamous Ask Professor Stoner Column  

         
 

fight the Man™... support standard Instant Messaging protocols!

fight the Man™!   Does capitalism always have to be so... gaudy?

UBB TITLE HACK INSTRUCTIONS

First of all, you will need to open up your ubblibrary.pl file.  Once you've got it open, find this line:

$Version = "5.44";

If your version number is not 5.44, your mileage may vary - I have only tested this hack with UBB 5.44, registered version!  If anybody uses this hack successfully with any other versions of UBB, please drop me a line and let me know what version you are using and how it went.  Hell, drop me a line anyway - I get a kick out of hearing about people using my hacks.

(Update: the hack has now been successfully used with all versions from 5.42a through 5.47d.)

At any rate, once you've found that line, insert the following block of code immediately after it:

########################################################
#                                                      #
# Smart title parsing routine by jimbo@jimbosworld.org #
#                                                      #
########################################################

sub ParseUserTitles{
# Check for Post Count titles
my @posttitles = &OpenFile("$MembersPath/title-list2.file");

foreach $thisline(@posttitles) {
my @postnumtitles = split(/\|\!\!\|/, $thisline);
chomp($postnumtitles[1]);

if ($thisprofile[7] > $postnumtitles[0]) {
$ThisStatus = "$postnumtitles[1]";
}
}

# Check for Admin / Moderator Titles
if ($thisprofile[8] eq "Administrator") {
$ThisStatus = "$AdminTitle";
}
elsif ($thisprofile[8] eq "Moderator") {
$ThisStatus = "$ModeratorTitle";
}


# Check for Username Specific Titles
my @spectitles = &OpenFile("$MembersPath/title-list.file");

foreach $thisline(@spectitles) {
my @titles = split(/\|\!\!\|/, $thisline);
chomp($titles[1]);

if ($thisprofile[0] eq "$titles[0]") {
$ThisStatus = "$titles[1]";
}
}
} # end smart title parsing routine

#################################################
#                                               #
# Control Panel for Jimbo's Smart Title parsing #
# Written by Skalos                             #
#                                               #
#################################################

sub UserTitles {
$PageTitle = "U S E R T I T L E S";
&HEADERHTML1;
print<<ForumLoginHTML;
<center>
<FONT SIZE="1" FACE="Verdana, Arial" COLOR="#800000">You must be an administrator
to change custom user titles.</FONT>
<P>
<FORM ACTION="$CGIURL/cpanel3.cgi" METHOD="POST" NAME="THEFORM" onSubmit="return
Check(this)">
ForumLoginHTML

&IDTable;

print<<ENDIT;
<P></font>
<INPUT TYPE="HIDDEN" NAME="action" VALUE="viewusertitles">
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit Identification Now">
</FORM>
<BR><BR><BR>
</CENTER></BODY></HTML>
ENDIT
}

sub ViewUserTitles {
&VerifyAdminCP($UserName, $Password);
if ($Proceed eq "true") {
#get current user titles
my @spectitles = &OpenFile("$MembersPath/title-list.file");
$titles = join(/\n/, @spectitles);
#get the current titles by post
my @spectitles = &OpenFile("$MembersPath/title-list2.file");
$posttitles = join(/\n/, @spectitles);
$PageTitle = "<font face=\"Arial\" size=\"4\"><b>U S E R &nbsp;&nbsp;&nbsp;&nbsp; T I T L E S</b></font>";
&HEADER2HTML;

####################################
# For best visibility on screen,
# you should set $numColumns to:
#
# 55 if you use 640x480 resolution
# 70 if you use 800x600 resolution
# 105 if you use 1024x768 resolution
#
####################################
#
$numColumns=70;
#
####################################

print<<TITLES;
<P>

<FORM ACTION="$CGIURL/cpanel3.cgi" METHOD="POST" NAME="THEFORM">

<CENTER>
<table border=0 cellpadding=0 cellspacing=0><TR><td bgcolor="#000000">
<table border=0 cellpadding=4 border=0 cellspacing=1>
<TR bgcolor="#B0BB9D">
<TD colspan=2 align=center><FONT SIZE="1" FACE="Verdana, Arial">
<B>You can set custom user titles below
by specifying them in the form of: &lt;name&gt;|!!|&lt;title&gt;, one per line</B></FONT>
</TD>
</tr>
<TR bgcolor="#f7f7f7">
<td valign=top colspan=2>
<FONT SIZE="2" FACE="Verdana, Arial"><B>User Titles:</B></FONT>
</td></tr>
<tr><td valign=top colspan=2>
<TEXTAREA NAME="titles" COLS="$numColumns" ROWS="10" WRAP="OFF">$titles</TEXTAREA>
</td></tr>
TITLES

print<<BOTTOM;
<TR bgcolor="#B0BB9D">
<TD colspan=2 align=center><FONT SIZE="1" FACE="Verdana, Arial">
<B>You can set titles by rank below by specifying them in the form
of: &lt;post-count&gt;|!!|&lt;title&gt;, one per line</B></FONT>
</TD>
<TR bgcolor="#f7f7f7">
<td valign=top colspan=2>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Titles By Post:</B></FONT>
</td></tr>
<tr><td valign=top colspan=2>
<TEXTAREA NAME="posttitles" COLS="$numColumns" ROWS="10" WRAP="OFF">$posttitles</TEXTAREA>
</td></tr>
BOTTOM

print<<BOTTOM;
</TR>
<TR bgcolor="#C7C6BA">
<TD><FONT Size="2" FACE="Verdana, Arial">
UserName:</font></TD><TD><INPUT TYPE="TEXT" NAME="UserNameCheck" SIZE=25
MAXLENGTH=25></td></tr>
<TR bgcolor="#C7C6BA">
<TD><FONT Size="2" FACE="Verdana, Arial">Password</font></TD><TD><INPUT
TYPE="PASSWORD" NAME="PasswordCheck" SIZE=13 MAXLENGTH=13></TD></tr>
</table>
</td></tr></table>
<P>
<INPUT TYPE="HIDDEN" NAME="action" VALUE="submitusertitles">

<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit User Titles">
</FORM>
<P><BR>
</CENTER>
</body></html>
BOTTOM

}
} #end ViewUserTitles

sub SubmitUserTitles {
&VerifyAdminCP($UserNameCheck, $PasswordCheck);
if ($Proceed eq "true") {
$Titles = $in{'titles'};
chomp($Titles);
$PostTitles = $in{'posttitles'};
chomp($PostTitles);

&Lock("lock.file");
open(TITLES, ">$MembersPath/title-list.file");
print TITLES"$Titles";
close(TITLES);
open(TITLES, ">$MembersPath/title-list2.file");
print TITLES"$PostTitles";
close(TITLES);
&Unlock("lock.file");
chmod (0777, "$MembersPath/title-list.file");
chmod (0777, "$MembersPath/title-list2.file");

&EndUpdate("U S E R &nbsp;&nbsp;&nbsp;&nbsp; T I T L E S &nbsp;&nbsp;&nbsp;&nbsp;
U P D A T E D", "<CENTER>Your user titles list has been successully updated!<br>Don't forget
to update your threads so the new titles will show up on the current posts!</CENTER>");
}
} # end SubmitUserTitles

########################################################
#                                                      #
# End of Smart Title routines                          #
#                                                      #
########################################################

Whew!  Don't worry, there won't be any more massive chunks of code like that - we got it all over with in one fell swoop.  The other couple of changes are extremely simple, and only one or two lines each.  The advantage to doing it this way is that, if for any reason you should ever decide to remove the custom title hack, you won't have to "restore" anything at all should you ever decide to get rid of the hack - you can just delete all the code, and your UBB will revert to working just as it did before.

OK.  Now that you've saved (and uploaded) your ubblibrary.pl file, now it's time to move on to the ubblibrary_2.pl file.  Once you've got it open, find the following lines:

if ($ThisStatus eq "Administrator") {
    $ThisStatus = "$AdminTitle";
}
elsif ($ThisStatus eq "Moderator") {
    $ThisStatus = "$ModeratorTitle";
}
elsif ($ThisStatus eq "Member") {
    $ThisStatus = "$MemberTitle";
} else {
    $ThisStatus = "$JrMemberTitle";
}
} else {
    $RegName = "unreg";
}

And insert the following code block immediately afterward:

#########################################
# Run Jimbo's Smart Title Parsing routine
#########################################
&ParseUserTitles;
#########################################

Now find this code snippet:

$ThisThread .= qq(<tr $AlternateColor>
    <TD width=18% valign=top>
    <FONT SIZE="$TextSize" face="$FontFace"><B>$thisline[2]</B></font><BR><FONT SIZE="1" face="$FontFace">$ThisStatus $AuthorExtra</FONT>
</td>
<TD>

And change it to read as follows: (all you're doing is adding valign="top" to the last tag)

$ThisThread .= qq(<tr $AlternateColor>
    <TD width=18% valign=top>
    <FONT SIZE="$TextSize" face="$FontFace"><B>$thisline[2]</B></font><BR><FONT SIZE="1" face="$FontFace">$ThisStatus $AuthorExtra</FONT>
</td>
<TD valign="top">

Save ubb_library2.pl, and upload it.  Now load up ubbmisc.cgi, and search for the following lines:

if ($thisprofile[8] eq "Administrator") {
    $ThisStatus = "$AdminTitle";
}
elsif ($thisprofile[8] eq "Moderator") {
    $ThisStatus = "$ModeratorTitle";
}
elsif ($thisprofile[8] eq "Member") {
    $ThisStatus = "$MemberTitle";
} else {
    $ThisStatus = "$JrMemberTitle";
}

And insert the same code block you did in ubblibrary_2.pl immediately afterwards:

#########################################
# Run Jimbo's Smart Title Parsing routine
#########################################
&ParseUserTitles;
#########################################

Save it, upload it, and now we're ready to tackle cpanel.cgi - open it and search for the following line:

if ($action eq "logintoforums") {
&LogIntoForums;
}

Now insert the following code immediately after it:

###########################################
#
# Jimbo/Skalos Custom Title Editing section
#
###########################################
#
if ($action eq "usertitles") {
&UserTitles;
}
if ($action eq "viewusertitles") {
&ViewUserTitles;
}
#
###########################################

Save it, upload it, and open cpanel3.cgi - search for the following line:

if ($action eq "viewbanlist") {
&ViewBanList;
}

And insert the following code immediately after:

###########################################
#
# Jimbo/Skalos Custom Title Editing section
#
###########################################
#
if ($action eq "viewusertitles") {
&ViewUserTitles;
}
if ($action eq "submitusertitles") {
&SubmitUserTitles;
}
#
###########################################

Save it, upload it, only one more file to go!  Load up cplinks.html and look for these lines:

<A HREF="cpanel.cgi?action=permissions" target="CPMAIN">User Info & Permissions</A>
<HR>

And insert the following lines immediately after:

<A HREF="cpanel.cgi?action=usertitles" target="CPMAIN">User Titles</A>
<HR>

Save it, upload it, and we're done hacking and ready to get started adding user names!

Once you've got all this stuff saved and uploaded, you'll want to go to your control panel and click on the "User Titles" link.  If this is the first time you've run it, you will get an internal error.  Don't worry - that's not a problem, it's whining because there were no title list files.  But it created them for you when it gave you the error, so click the link again, and this time you'll see your new Custom User Titles applet.

If for some reason you keep getting Internal Server Errors, and the applet never loads - you might want to try manually making a title-list.file and a title-list2.file.   Just make empty text files, name them title-list.file and title-list2.file, and upload them into your Members directory.  Your applet should now load. 

Maintenance is pretty simple - in the top window, give individual users custom titles by entering a line with their name, a |!!| separator, and the title - just remember that the member name has to match exactly, and it is case-specific!  You can do some pretty clever things with the titles by using HTML - any HTML tags you use in the title WILL render correctly; you just need to remember that it all has to fit on one line.  If you want to make a new line in a title, use the <br> tag - because if you press enter, you'll be starting a new line, and your title won't work right. 

Example: Jimbo|!!|Code P1mp <br><img src="/images/icon.gif">

The bottom window works just the same as the top one, except that instead of usernames, the first field is post counts - anybody with greater than that number of posts will get the title, unless they are a moderator or admin or you have given them a custom title.  IMPORTANT: remember to keep your post counts in numeric order, or you will get unpredictable results!

Example:   0|!!|Newbie
10|!!|Member
30|!!|Regular
50|!!|Veteran

Well, that about wraps it up - I hope you enjoy the mods... and if all this seems a bit daunting to you, I am available for hire to install this mod or to make custom mods to your UBB and install them for you.- drop me a line to discuss what you want done; my rates are reasonable.  Have fun!

PS: Kudos in the extreme to Skalos, who took the time to write the control panel add-on for the hack.  Good job, man!

 

  Validate this site's existence.  Affirm your own.
         Glorify mine. 
Sign the guestbook.

Click Here!