12-06-2000, 07:02 PM
This hack allows the user to specify an image from anywhere on the internet to appear under their user name. It was initially requested here (http://www.vbulletin.com/forum/showthread.php?threadid=5282).
This is my first public hack that serves a purpose, so be gentle. It's a little rough around the edges, possibly my good friends Mike or freddie could take a look and see if I forgot anything.
Here is an example:
http://www.bronx-bombers.com/vb114/showthread.php?threadid=2
Here is the code:
First, run the following SQL query to create a new field in the user table:
ALTER TABLE user ADD imgurl VARCHAR (100) not null
Next, open showthread.php:
Find:
$temps=$DB_site->query("SELECT title,template
FROM template
WHERE title='error_invalidid' OR title='error_nopermission' OR
title='$foruminfo[rulestemplate]'
OR title='forumrules' OR title='error_forumclosed' OR
title='showthread_numpages'
OR title='postbit_useremail' OR title='icq' OR title='aim' OR
title='yahoo'
OR title='postbit_homepage' OR title='postbit_profile' OR
title='$usetemplatebit'
OR title='firstunread' OR title='showthread_nextnewestthread'
OR title='showthread_nextoldestthread' OR
title='$foruminfo[headertemplate]'
OR title='$foruminfo[footertemplate]' OR title='$usetemplate'");
while ($temp=$DB_site->fetch_array($temps)) {
$templatecache["$temp[title]"]=$temp[template];
}
Replace With:
$temps=$DB_site->query("SELECT title,template
FROM template
WHERE title='error_invalidid' OR title='error_nopermission' OR
title='$foruminfo[rulestemplate]'
OR title='forumrules' OR title='error_forumclosed' OR
title='showthread_numpages'
OR title='postbit_useremail' OR title='icq' OR title='aim' OR
title='yahoo' OR title='custom_img'
OR title='postbit_homepage' OR title='postbit_profile' OR
title='$usetemplatebit'
OR title='firstunread' OR title='showthread_nextnewestthread'
OR title='showthread_nextoldestthread' OR
title='$foruminfo[headertemplate]'
OR title='$foruminfo[footertemplate]' OR title='$usetemplate'");
while ($temp=$DB_site->fetch_array($temps)) {
$templatecache["$temp[title]"]=$temp[template];
}
Find:
$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as postid,post.pagetext as
pagetext,
post.allowsmilie as allowsmilie,post.signature AS
showsignature,post.title as title,
post.ipaddress as ipaddress,post.iconid as iconid,post.username as
fakename,
post.userid as userid,
user.userid as userid,user.email as email,user.username as username,
user.usertitle as usertitle,user.signature as
signature,user.showemail as showemail,
user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo
as yahoo,
user.joindate as joindate,user.posts as posts
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.threadid=$threadid AND visible=1
ORDER BY dateline $postorder
LIMIT $limitlower,$perpage");
And Replace With:
$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as postid,post.pagetext
as pagetext,
post.allowsmilie as allowsmilie,post.signature AS
showsignature,post.title as title,
post.ipaddress as ipaddress,post.iconid as iconid,post.username as
fakename,
post.userid as userid,
user.userid as userid,user.email as email,user.username as username,
user.usertitle as usertitle,user.signature as
signature,user.showemail as showemail,
user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo
as yahoo,user.imgurl as imgurl,
user.joindate as joindate,user.posts as posts
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.threadid=$threadid AND visible=1
ORDER BY dateline $postorder
LIMIT $limitlower,$perpage");
Find:
if ($userinfo[icq]!="") {
$icqnumber=$userinfo[icq];
eval("\$icq = \"".gettemplate("icq")."\";");
} else {
$icqnumber="";
$icq="";
}
And After It, Add This:
if ($userinfo[imgurl]!="") {
$custom_img=$userinfo[imgurl];
eval("\$imgurl = \"".gettemplate("custom_img")."\";");
} else {
$custom_img="";
$imgurl="";
}
Save and close showthread.php.
Open member.php
In the "Modify Profile" function, find:
$timezoneoffset=$userinfo[timezoneoffset];
After it, add:
$imgurl=htmlspecialchars($userinfo[imgurl]);
In the "Update Profile" Section, Find:
$DB_site->query("UPDATE user
SET password='".addslashes($password)."',email='".addslashes($email)."',
parentemail='".addslashes($parentemail)."',coppauser=$coppauser,homepage='".addslashes($homepage)."
',
icq='".addslashes($icq)."',aim='".addslashes($aim)."',yahoo='".addslashes($yahoo)."',
biography='".addslashes($biography)."',signature='".addslashes($signature)."',adminemail=$adminemai
l,
showemail=$showemail,invisible=$invisible,cookieus er=$cookieuser,daysprune=$prunedays,
timezoneoffset=$timezoneoffset,emailnotification=$ emailnotification
WHERE userid=$userid");
And replace with:
$DB_site->query("UPDATE user
SET password='".addslashes($password)."',email='".addslashes($email)."',
parentemail='".addslashes($parentemail)."',coppauser=$coppauser,homepage='".addslashes($homepage)."
',
icq='".addslashes($icq)."',aim='".addslashes($aim)."',yahoo='".addslashes($yahoo)."',
biography='".addslashes($biography)."',signature='".addslashes($signature)."',adminemail=$adminemai
l,imgurl='".addslashes($imgurl)."',
showemail=$showemail,invisible=$invisible,cookieus er=$cookieuser,daysprune=$prunedays,
timezoneoffset=$timezoneoffset,emailnotification=$ emailnotification
WHERE userid=$userid");
Go ahead and update those files, now we have to edit templates:
Open the "modifyprofile" template, and put the following code in there somewhere:
<tr bgcolor="#DEDEDE">
<td><B><FONT face="verdana, arial, helvetica" size="2" >Custom Image URL:</font></B></td>
<td><INPUT TYPE="TEXT" NAME="imgurl" VALUE="$imgurl" SIZE=30 MAXLENGTH=100></td>
</tr>
Save That.
Open the "postbit" template, and add this wherever you want to put the image, specifying the proper height and width:
<img src="$custom_img" height="xx" width="xx">
That's it, you're all done.
I just noticed that for users that don't specify an image, you get an red x - I'll try to fix that now.
Other than that, I can't provide a lot of support, because I forgot half of what I did :).
-jim
This is my first public hack that serves a purpose, so be gentle. It's a little rough around the edges, possibly my good friends Mike or freddie could take a look and see if I forgot anything.
Here is an example:
http://www.bronx-bombers.com/vb114/showthread.php?threadid=2
Here is the code:
First, run the following SQL query to create a new field in the user table:
ALTER TABLE user ADD imgurl VARCHAR (100) not null
Next, open showthread.php:
Find:
$temps=$DB_site->query("SELECT title,template
FROM template
WHERE title='error_invalidid' OR title='error_nopermission' OR
title='$foruminfo[rulestemplate]'
OR title='forumrules' OR title='error_forumclosed' OR
title='showthread_numpages'
OR title='postbit_useremail' OR title='icq' OR title='aim' OR
title='yahoo'
OR title='postbit_homepage' OR title='postbit_profile' OR
title='$usetemplatebit'
OR title='firstunread' OR title='showthread_nextnewestthread'
OR title='showthread_nextoldestthread' OR
title='$foruminfo[headertemplate]'
OR title='$foruminfo[footertemplate]' OR title='$usetemplate'");
while ($temp=$DB_site->fetch_array($temps)) {
$templatecache["$temp[title]"]=$temp[template];
}
Replace With:
$temps=$DB_site->query("SELECT title,template
FROM template
WHERE title='error_invalidid' OR title='error_nopermission' OR
title='$foruminfo[rulestemplate]'
OR title='forumrules' OR title='error_forumclosed' OR
title='showthread_numpages'
OR title='postbit_useremail' OR title='icq' OR title='aim' OR
title='yahoo' OR title='custom_img'
OR title='postbit_homepage' OR title='postbit_profile' OR
title='$usetemplatebit'
OR title='firstunread' OR title='showthread_nextnewestthread'
OR title='showthread_nextoldestthread' OR
title='$foruminfo[headertemplate]'
OR title='$foruminfo[footertemplate]' OR title='$usetemplate'");
while ($temp=$DB_site->fetch_array($temps)) {
$templatecache["$temp[title]"]=$temp[template];
}
Find:
$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as postid,post.pagetext as
pagetext,
post.allowsmilie as allowsmilie,post.signature AS
showsignature,post.title as title,
post.ipaddress as ipaddress,post.iconid as iconid,post.username as
fakename,
post.userid as userid,
user.userid as userid,user.email as email,user.username as username,
user.usertitle as usertitle,user.signature as
signature,user.showemail as showemail,
user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo
as yahoo,
user.joindate as joindate,user.posts as posts
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.threadid=$threadid AND visible=1
ORDER BY dateline $postorder
LIMIT $limitlower,$perpage");
And Replace With:
$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as postid,post.pagetext
as pagetext,
post.allowsmilie as allowsmilie,post.signature AS
showsignature,post.title as title,
post.ipaddress as ipaddress,post.iconid as iconid,post.username as
fakename,
post.userid as userid,
user.userid as userid,user.email as email,user.username as username,
user.usertitle as usertitle,user.signature as
signature,user.showemail as showemail,
user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo
as yahoo,user.imgurl as imgurl,
user.joindate as joindate,user.posts as posts
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.threadid=$threadid AND visible=1
ORDER BY dateline $postorder
LIMIT $limitlower,$perpage");
Find:
if ($userinfo[icq]!="") {
$icqnumber=$userinfo[icq];
eval("\$icq = \"".gettemplate("icq")."\";");
} else {
$icqnumber="";
$icq="";
}
And After It, Add This:
if ($userinfo[imgurl]!="") {
$custom_img=$userinfo[imgurl];
eval("\$imgurl = \"".gettemplate("custom_img")."\";");
} else {
$custom_img="";
$imgurl="";
}
Save and close showthread.php.
Open member.php
In the "Modify Profile" function, find:
$timezoneoffset=$userinfo[timezoneoffset];
After it, add:
$imgurl=htmlspecialchars($userinfo[imgurl]);
In the "Update Profile" Section, Find:
$DB_site->query("UPDATE user
SET password='".addslashes($password)."',email='".addslashes($email)."',
parentemail='".addslashes($parentemail)."',coppauser=$coppauser,homepage='".addslashes($homepage)."
',
icq='".addslashes($icq)."',aim='".addslashes($aim)."',yahoo='".addslashes($yahoo)."',
biography='".addslashes($biography)."',signature='".addslashes($signature)."',adminemail=$adminemai
l,
showemail=$showemail,invisible=$invisible,cookieus er=$cookieuser,daysprune=$prunedays,
timezoneoffset=$timezoneoffset,emailnotification=$ emailnotification
WHERE userid=$userid");
And replace with:
$DB_site->query("UPDATE user
SET password='".addslashes($password)."',email='".addslashes($email)."',
parentemail='".addslashes($parentemail)."',coppauser=$coppauser,homepage='".addslashes($homepage)."
',
icq='".addslashes($icq)."',aim='".addslashes($aim)."',yahoo='".addslashes($yahoo)."',
biography='".addslashes($biography)."',signature='".addslashes($signature)."',adminemail=$adminemai
l,imgurl='".addslashes($imgurl)."',
showemail=$showemail,invisible=$invisible,cookieus er=$cookieuser,daysprune=$prunedays,
timezoneoffset=$timezoneoffset,emailnotification=$ emailnotification
WHERE userid=$userid");
Go ahead and update those files, now we have to edit templates:
Open the "modifyprofile" template, and put the following code in there somewhere:
<tr bgcolor="#DEDEDE">
<td><B><FONT face="verdana, arial, helvetica" size="2" >Custom Image URL:</font></B></td>
<td><INPUT TYPE="TEXT" NAME="imgurl" VALUE="$imgurl" SIZE=30 MAXLENGTH=100></td>
</tr>
Save That.
Open the "postbit" template, and add this wherever you want to put the image, specifying the proper height and width:
<img src="$custom_img" height="xx" width="xx">
That's it, you're all done.
I just noticed that for users that don't specify an image, you get an red x - I'll try to fix that now.
Other than that, I can't provide a lot of support, because I forgot half of what I did :).
-jim