vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   [Release] Custom Image Under User Name (https://vborg.vbsupport.ru/showthread.php?t=5301)

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.

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/s...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:
Code:

$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:

Code:

$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:
Code:

$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:
Code:

$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:

Code:

    if ($userinfo[icq]!="") {
      $icqnumber=$userinfo[icq];
      eval("\$icq = \"".gettemplate("icq")."\";");
    } else {
      $icqnumber="";
      $icq="";
    }

And After It, Add This:

Code:

    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:

Code:

  $timezoneoffset=$userinfo[timezoneoffset];
After it, add:

Code:

  $imgurl=htmlspecialchars($userinfo[imgurl]);


In the "Update Profile" Section, Find:

Code:

  $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,cookieuser=$cookieuser,daysprune=$prunedays,
                      timezoneoffset=$timezoneoffset,emailnotification=$emailnotification
                  WHERE userid=$userid");

And replace with:

Code:

  $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,cookieuser=$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:

Code:

<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:

Code:

<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

12-06-2000 07:13 PM

How about setting a default image for everybody then all they have to do is change it. that way you wouldn't get a red x

12-06-2000 07:19 PM

I could do that, but I want to have it so it only appears if there is a URL specified, like the way the homepage link is setup.

-jim

12-06-2000 07:21 PM

Quote:

Originally posted by Philly
How about setting a default image for everybody then all they have to do is change it. that way you wouldn't get a red x

Oh there's a red x? No, no I would rather prefere no images at all if not specified by the user.
BTW tnx for this great hack JimF!!!! :thumbup:

12-06-2000 08:08 PM

Quote:

Originally posted by JimF
First, run the following SQL query to create a new field in the user table:

ALTER TABLE user ADD imgurl VARCHAR (100) not null

Er... actually the table "user" does not exist.
Also, instead of the image I got a broken image URL linked to my board url (like "http://www.mydomain.com/forums/").

12-06-2000 08:13 PM

Also
I noticed that the URL image cannot be saved on the profile: everytime I go back to my profile, the "Custom Image URL" field is empty.
Maybe does it depend on the missing MySQL table field?

12-06-2000 08:14 PM

Is this on your site, or on my demo site?

You need to create the row in MySQL or it won't work.

-jim

12-06-2000 08:20 PM

Quote:

Originally posted by JimF
Is this on your site, or on my demo site?

You need to create the row in MySQL or it won't work.

-jim

It's on my site but I'm realizing just now that something may have been fu**ed up. There are some tables missing on my DB! Or maybe phpMyAdmin went crazy... :confused:

12-06-2000 08:32 PM

OK, le't say I made clear that the DB is still working properly. I've only a strange phpMyAdmin problem which is not reporting all tables... :confused:
Anyway, I can remember that when I inserted your MySQL command I got a confirm message that everything went fine. :)
Now, the only thing is the fact that instead of the image I get that broken img linked to my board index...

12-07-2000 12:37 AM

There is always my Avatar hack which sets a default of no image, instructions for using it w 1.1.4 are at the end of the thread

http://www.vbulletin.com/forum/showt...?threadid=2127


All times are GMT. The time now is 08:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01108 seconds
  • Memory Usage 1,788KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (12)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete