vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Avatar on homepage (https://vborg.vbsupport.ru/showthread.php?t=32560)

Admin 11-20-2001 10:00 PM

This is what we use on the main page of this forum.
So many people liked it and asked for it, I posted it on at least 5 threads already, but someone wanted a proper release so here it is. :)

Anyway, in index.php add this:
Code:

if ($bbuserinfo[userid]!=0) {
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='') {
    $avatarurl='{imagesfolder}/noavatar.gif';
  }
  $avatarimage='<img src="'.$avatarurl.'">';
} else {
  $avatarimage='<a href="register.php?s='.$session[sessionhash].'&action=signup"><img src="{imagesfolder}/guestavatar.gif"></a>';
}

right after this:
Code:

$permissions=getpermissions();
if (!$permissions['canview']) {
        show_nopermission();
}

Now in any of your forumhome_xxx templates, you can use this:
Code:

$avatarimage
to display the user's avatar.

It will display the user's avatar if he has selected one, if he hasn't selected one it will show noavatar.gif (you'll need to upload that to your images folder), and if it's a guest, it will show guestavatar.gif, and link the image to register.php.

TheComputerGuy 11-21-2001 12:08 PM

I like it, nice work there Firefly

squawell 11-21-2001 12:36 PM

it's good hack for me thankz FireFly~~

if i want it show up like main page of this forum what template

should i put this code$avatarimage?

forumhome or .....??

SgtSling 11-21-2001 01:46 PM

forumhome template

SgtSling 11-21-2001 01:46 PM

or any of the other's that are listed under forumhome

snyx 11-21-2001 02:47 PM

oh yeah, love'n it firefly!
http://www.form-kaos.com/board/

Sinecure 11-21-2001 03:00 PM

How would I go about using $avatarimage in my header template. Modifying something in functions.php correct?

Admin 11-21-2001 03:08 PM

Add the code to global.php, before:
Code:

$header='';

Sinecure 11-21-2001 03:15 PM

Thank You :D

Mike Gaidin 11-21-2001 08:44 PM

Thanks FireFly!

JTMON 11-22-2001 06:04 AM

Awesome Hack Firefly. What part of the code would I change to make it so the noavatar.gif is linked to userCP?

Crinos 11-22-2001 08:55 AM

w00t! Works great! Excellent hack, cheers!

See it in action ;)
http://www.opentechsupport.net/forums/

Admin 11-22-2001 11:42 AM

[QUOTE]Originally posted by JTMON
Awesome Hack Firefly. What part of the code would I change to make it so the noavatar.gif is linked to userCP?

Matt 11-22-2001 11:11 PM

Is there anyway to encorporate this into a non-vb page?

JTMON 11-22-2001 11:24 PM

For some reason that code didn't work for me firefly. I just get a red x if I don't have an avatar selected, but no noavatar.gif. I have reuploaded the gif file twice too. Otherwise it works great.

JTMON 11-23-2001 12:06 AM

ok I got it working now. I had to do this:

Code:

if ($bbuserinfo[userid]!=0) {
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='') {
    $avatarurl='images/noavatar.gif';
  }
  $avatarimage='<a href="member.php3?s='.$session[sessionhash].'&action=editavatar"><img src="'.$avatarurl.'">';
} else {
  $avatarimage='<a href="register.php?s='.$session[sessionhash].'&action=signup"><img src="images/guestavatar.gif"></a>';
}

I chose to link right into the edit avatar spot instead but I had tack on the code you gave me to the beginning of:

$avatarimage'<img src="'.$avatarurl.'">';

JTMON 11-23-2001 02:17 AM

hmm, the only problem now is I have a box around the avatar?

Bane 11-23-2001 03:48 AM

Try changing
Code:

<img src="'.$avatarurl.'">
to
Code:

<img src="'.$avatarurl.'" border="0">

JTMON 11-23-2001 03:51 AM

Thanks Bane!! Worked perfectly!:D

Jakeman 11-26-2001 04:18 AM

hey Crinos (Tolitz i presume?), gimme your forumhome template. i want your table layout for the top box with the ava in it... i'm having brain farts here. :stupid: :D

Crinos 11-26-2001 06:13 AM

LOL, I wish it was that easy - the whole process of putting it together is scattered althroughout several templates:

forumhome
forumhome_unregmessage
forumhome_welcometext
forumhome_logincode
forumhome_logoutcode
forumhome_pmloggedin

I'm afraid giving you just the forumhome template is not gonna be useful ;)

Took me about 3-4 hours of trial and error just trying to put it together ... what I did was set up a "mock-up" page with the layout as I want it to be ... then I just insert the relevant code and then chop it up by the <tr>'s and insert each one in the templates I mentioned :D

Jakeman 11-26-2001 06:43 AM

oic. ok then... i'll manage :)

trilOByte 11-26-2001 08:48 AM

Hey man, I think I just posted what you are looking for. I installed it all together, then wrote a walkthrough of most of it for a friend, thought someone might find it usefull, so uploaded the zip here...

https://vborg.vbsupport.ru/showthrea...threadid=32702

See my sig for a working example.

Even if it's not exactly what you are looking for, it should give you the *bones* to play with!

trilOByte 11-26-2001 08:51 AM

Thinking about it, I prolly should have posted it here - not sure about the protocol for such things :rolleyes:

Anyway, I *think* I included all the edits :rolleyes: :rolleyes: :D :D

Jakeman 11-27-2001 02:06 AM

thanks :)

Jakeman 11-27-2001 06:13 PM

cool... check out my www link

fiona 11-30-2001 04:10 PM

Quote:

Originally posted by JTMON
For some reason that code didn't work for me firefly. I just get a red x if I don't have an avatar selected, but no noavatar.gif. I have reuploaded the gif file twice too. Otherwise it works great.
have you checked the path to the image matches with what you have in index.php
ie mine is images/noavatar.gif

but in the code given by Firefly its
Quote:

<img src="vbimages/noavatar.gif">
i had the same problem :D

Gamingforce 11-30-2001 04:50 PM

Really nice hack Firefly. I would install it but the default avatar size for our message board is 105x150 making the avatar take up too much board real estate. Awesome job though Firefly!

JTMON 11-30-2001 09:10 PM

Quote:

Originally posted by fiona


i had the same problem :D

Well it's been images for me this whole time. I never saw vbimages. I changed the coding so if they don't have an avatar it gives them the no avatar but it's also linked to the edit avatar page:D

westi 12-02-2001 12:59 PM

Hi,

Quote:

Originally posted by Matt
Is there anyway to encorporate this into a non-vb page?
include the follow global.php to your page...

PHP Code:

<?
// global.php
// Diese Datei ist f?r Webseiten die auf Funktionen eines vBulletin zugreifen
// wollen.
// Autor: westi (westi@ftpworld.org)
// Stand: v1.0 / 2001-12-02

$boardpath="/path/to/the/board";

unset($dbservertype);
//load config
require("$boardpath/admin/config.php");
require("$boardpath/admin/functions.php");

// init db **********************
// load db class
$dbservertype = strtolower($dbservertype);
$dbclassname="$boardpath/admin/db_$dbservertype.php";
require($dbclassname);

$DB_site=new DB_Sql_vb;
$DB_site->appname="vBulletin Control Panel";
$DB_site->appshortname="vBulletin (cp)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;
$DB_site->connect();

$dbpassword="";
$DB_site->password="";
// end init db

// load options
$optionstemp=$DB_site->query_first("SELECT template FROM template WHERE title='options'");
eval($optionstemp[template]);
// ################ END INIT #################

if ($bbuserid!="") {
  $user=getuserinfo($bbuserid);
  $username=$user[username];
  $lastday=vbdate($dateformat,$user[lastvisit]+3600);
  $lasttime=vbdate($timeformat,$user[lastvisit]+3600);
  $templatesetid=$DB_site->query_first("SELECT templatesetid AS templatesetid FROM style WHERE styleid=$user[styleid]");
  $templatesetid=$templatesetid[templatesetid];

  $avatarurl=getavatarurl($user[userid]);
  if ($avatarurl=='') {
    $avatarurl='images/noavatar.gif';
  }
  $avatarimage='<a href="'.$bburl.'/member.php3?action=editavatar"><img src="'.$bburl.'/'.$avatarurl.'" border="0"></a>';
} else {
  $avatarimage='<a href="'.$bburl.'/register.php?action=signup"><img src="'.$bburl.'/images/guestavatar.gif" border="0"></a>';
}

}

?>

greets,
westi

Airwaves 12-02-2001 08:24 PM

Where do I put

PHP Code:

$avatarimage 

to place it in the same place as on vb.org main forum page?

Airwaves 12-03-2001 07:27 PM

Bump

cant anyone help a n00b ?

JTMON 12-03-2001 09:10 PM

in the forumhome template, right above $postbits :D

Airwaves 12-04-2001 06:48 AM

I cannot find $postbits in the forumdisplay template ??

Lesane 12-04-2001 07:16 AM

Put it in the forumhome template like Firefly said in his first post!

Bedhead 12-04-2001 10:04 AM

I have done everything step by step, but where exactly does $avatarimage go in the forumhome template.

Bedhead 12-04-2001 10:05 AM

If it is installed here, how come i don't have it as noavater here as i have not selected one here?
Confused.

Bedhead 12-04-2001 10:31 AM

I got it.
I thought this hack would add it to each member in the posts.
It is only on the main page.
Okay.

JTMON 12-04-2001 10:55 AM

Quote:

Originally posted by Bedhead
I got it.
I thought this hack would add it to each member in the posts.
It is only on the main page.
Okay.


Each member already has his avatar in his post...?

Airwaves 12-04-2001 08:00 PM

Having a bit of trouble with this...

I have the two image required in the /forums/images/avatars folder on my server, BUT, i still get a little red X in a box for someone who doesnt have an avatar set

here is the code in my index.php

PHP Code:

//avatar images
if ($bbuserinfo[userid]!=0) {
  
$avatarurl=getavatarurl($bbuserinfo[userid]);
  if (
$avatarurl=='') {
    
$avatarimage='<a href="usercp.php?s='.$session[sessionhash].'"><img border="0" src="images/avatars/noavatar.gif"></a>';
  }
  
$avatarimage='<img border="0" src="'.$avatarurl.'">';
} else {
  
$avatarimage='<a href="register.php?s='.$session[sessionhash].'&action=signup"><img border="0" src="images/avatars/guestavatar.gif"></a>';
}
//end avatar images 

I used a few fixes from the rest of this thread like removing the borders and making it linkk to the usercp to set an avatar.

please help?


All times are GMT. The time now is 03:51 AM.

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.01486 seconds
  • Memory Usage 1,827KB
  • 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
  • (7)bbcode_code_printable
  • (3)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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