<BLOCKQUOTE><font size="1" face=" Arial">quote:</font><HR>Custom User Image Hack
by Armage Bedar
People have been wondering about this for a while - so I've decided to put your minds at ease :-)
Features:
- Displays custom user image at any size
- Works well with custom user status and upload hacks
- Does NOT appear in CP and cannot be searched (don't know why you'd want to do it in the first place)
The commented lines are NOT necessary (they are simply directions and do not need to be pasted).
Let's go...
# In cpanel2.cgi (start from the top of the file):
#
# This is the control panel switch to allow/disallow the images.
#
# Find:
elsif ($DaysPruneDefault == 1000) {
$Days1000 = "SELECTED";
} else {
$Days365 = "SELECTED";
}
# and add immediately afterwards:
if ($allowimage EQ "NO") {
$imageoff = "CHECKED";
}
elsif ($allowimage EQ "YES") {
$imageon = "CHECKED"; }
else { $imageon = "CHECKED"; }
# find:
&InputRadioRow("#f7f7f7", "Author Column Display", "For each post, you can determine what information to display in the left column associated with the author of the post. The default is to only show the person's username and member status.", "<INPUT TYPE=\"RADIO\" NAME=\"AuthorColumn\" VALUE=\"Minimum\" $MinimumAC> Show username and status only.<BR>
<INPUT TYPE=\"RADIO\" NAME=\"AuthorColumn\" VALUE=\"PostTotal\" $PostTotalAC> Show username, status, registration date, post total.<BR><INPUT TYPE=\"RADIO\" NAME=\"AuthorColumn\" VALUE=\"Location\" $LocationAC> All of above plus location.<BR>");
# and add immediately beneath:
&InputRadioRow("#dedfdf", "Show custom user image with each post?", "These can be customized by each user from their profile.", "
<INPUT TYPE=\"RADIO\" NAME=\"allowimage\" VALUE=\"YES\" $imageon> Yes, show them.<BR>
<INPUT TYPE=\"RADIO\" NAME=\"allowimage\" VALUE=\"NO\" $imageoff> No, don't show them.");
# NOW ON TO CREATING THE EXTRA FIELDS IN THE USER PERMISSIONS
# AND DO THE SAVING OF THE EXTRA FIELD
#
# find:
print MEMBERSHIP ("$theprofile[14]\n");
# where '14' is the highest number in the MEMBERSHIP lines
# and add immediately beneath:
print MEMBERSHIP ("$theprofile[15]\n");
# CHECK THE CP STATUS OF THE TEXT HACK (ON/OFF/NOSTATUS):
# Open ubb_library2.pl
# Find:
if ($AllowIcons eq "TRUE") {
my $IconNumber = $thisline[9];
chomp($IconNumber);
if ($IconNumber eq "") {
$IconNumber = "1";
}
unless (-e "$NonCGIPath/icons/icon$IconNumber.gif") {
$IconNumber = "1";
}
$ThisIcon = qq(<IMG SRC="$NonCGIURL/icons/icon$IconNumber.gif" BORDER=0 ALIGN=ABSCENTER> );
} else {
$ThisIcon = qq(<IMG SRC="$NonCGIURL/posticon.gif" BORDER=0> );
}
# and add immediately beneath:
if ($allowimage EQ "YES") {
if ($thisprofile[15]) {
$thisimage = qq(<br><img src="$thisprofile[15]" height=60 width=60 border=0"> );
} else {
$thisimage = qq();
}
} else {
$thisimage = qq();
}
if ($RegName eq "unreg") {
$thisimage = "";
}
# Change the '60' in the "<img src..." line to whatever height and
# width you want the image to be restricted to. Delete those parts if you want no limit.
# (note that $ThisProfile[15]; should be the number for the new profile.
# Usually this will be 15, unless you have another user status hack installed.)
# DISPLAY THE NEW VARIABLE ON THE FORUM:
#
# Find:
$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</FONT>
</td>
# and add the following after '$ThisStatus':
$thisimage
# Make sure members don't overwrite their user image
# by adding in the correct MEMBERSHIP lines
#
# Open ubbmisc.cgi
#
# find:
if ($in{'Password'} eq "$thisprofile[1]") {
$pwmatch = "true";
$Password = $thisprofile[1];
$Email = $thisprofile[2];
$URL = $thisprofile[3];
$Occupation = $thisprofile[5];
$Location = $thisprofile[6];
$Interests = $thisprofile[9];
$Status = $thisprofile[8];
$TotalPosts = $thisprofile[7];
$Permissions = $thisprofile[4];
$DateRegistered = $thisprofile[10];
# and add immediately beneath:
$userimage = $thisprofile[15];
# find:
## Confirm UserName and Password to prevent hacking
$ProfileNumber = &GetUserNumber($UserName);
@profileinfo = &OpenProfile("$ProfileNumber.cgi");
$CurrentEmail = "$profileinfo[2]";
chomp($CurrentEmail);
$Permissions = "$profileinfo[4]";
chomp($Permissions);
$TotalPosts = "$profileinfo[7]";
$Status = "$profileinfo[8]";
$DateRegistered = "$profileinfo[10]";
# and add immediately beneath:
$userimage = "$profileinfo[15]";
# find:
print MEMBERSHIP ("$profileinfo[0]\n");
print MEMBERSHIP ("$Password\n");
print MEMBERSHIP ("$Email\n");
print MEMBERSHIP ("$URL\n");
print MEMBERSHIP ("$Permissions\n");
print MEMBERSHIP ("$Occupation\n");
print MEMBERSHIP ("$Location\n");
print MEMBERSHIP ("$TotalPosts\n");
print MEMBERSHIP ("$Status\n");
print MEMBERSHIP ("$Interests\n");
print MEMBERSHIP ("$DateRegistered\n");
print MEMBERSHIP ("$in{'EmailView'}\n");
print MEMBERSHIP ("$Signature\n");
print MEMBERSHIP ("$in{'ICQnum'}\n");
print MEMBERSHIP ("$in{'AllowMassMail'}\n");
# and add immediately beneath:
print MEMBERSHIP ("$in{'userimage'}\n");
# find:
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 add:
if ($allowimage eq "YES") {
$thisimage = qq%<img src="$thisprofile[15]"> (URL: $thisprofile[15])%;
}
else {$thisimage = ""; }
# find:
<td><FONT SIZE="$TextSize" FACE="$FontFace" COLOR="$TextColor">$ThisStatus</FONT>
# and replace with:
<td><FONT SIZE="$TextSize" FACE="$FontFace" COLOR="$TextColor">$ThisStatus$thisimage</FONT>
# Now we'll add the check to see if users changing the image is allowed.
#
# find:
if ($AllowMassMail eq "no") {
$AllowMailNo = "CHECKED";
$AMM = qq(<INPUT TYPE="HIDDEN" NAME="OldAMM" VALUE="no"> );
}
elsif ($AllowMassMail eq "") {
$AllowMailYes = "CHECKED";
$AMM = qq(<INPUT TYPE="HIDDEN" NAME="OldAMM" VALUE="blank"> );
} else {
$AllowMailYes = "CHECKED";
$AMM = qq(<INPUT TYPE="HIDDEN" NAME="OldAMM" VALUE="yes"> );
}
# and add:
$imagefield = "<tr $AltColumnColor2><td>
<B><FONT SIZE=\"$TextSize\" FACE=\"$FontFace\">User Image</FONT></B>
<BR><FONT SIZE=\"1\" FACE=\"$FontFace\">This text will show an image under your status when you post a message.</font>
</td><td>
<B><FONT SIZE=\"$TextSize\" FACE=\"$FontFace\">
<INPUT TYPE=\"text\" NAME=\"userimage\" VALUE=\"$userimage\" size=100 maxlength=200>
</FONT></B></td></tr>";
# find:
<INPUT TYPE="TEXT" NAME="ICQnum" VALUE="$ICQnumber" SIZE=7 MAXLENGTH=20>
# and add immediately beneath:
$imagefield
# and right below that remove
</td></tr>
# The code should now look like this:
<tr $AltColumnColor1>
<td>
<B><FONT SIZE="$TextSize" FACE="$FontFace">ICQ Nummer</FONT></B>
</td>
<td>
<INPUT TYPE="TEXT" NAME="ICQnum" VALUE="$ICQnumber" SIZE=7 MAXLENGTH=20>
$imagefield
<tr $AltColumnColor2>
<td valign=top>
<B><FONT SIZE="$TextSize" FACE="$FontFace">Signature</FONT></B><BR><FONT SIZE="1" FACE="$FontFace">
# etc...
#
# find :
print MEMBERSHIP ("$UserName\n");<B