Go Back   vb.org Archive > Community Central > vBulletin.org Site Feedback
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2001, 04:31 PM
dirgotronix dirgotronix is offline
 
Join Date: Oct 2001
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How did you do that? I'm tossing ideas about with my forumhome template that uses the avatar, but people with no avatar and guests just see something crappy. I was thinking of adding a row into the customavatars table with userid 0 but I'm afraid that would break something. How did you get the default avatar and avatar for guests?
Reply With Quote
  #2  
Old 11-05-2001, 06:54 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put this on index.php:
PHP Code:
if ($bbuserinfo['userid']!=0) {
  if (
$checkavatar=$DB_site->query_first("SELECT filename FROM customavatar WHERE userid='$bbuserinfo[userid]'")) {
    
$avatarurl='avatar.php?userid='.$bbuserinfo[userid];
  } else {
    
$avatarurl='{[i][/i]imagesfolder}/noavatar.gif';
  }
} else {
  
$avatarurl='{[i][/i]imagesfolder}/guestavatar.gif';

Now you use noavatar.gif for users with no avatars, guestavatar.gif for guests (that obviously don't have avatars), and add this to your forumhome template:
Code:
<img src="$avatarurl">
That's it.
Reply With Quote
  #3  
Old 11-19-2001, 05:28 AM
Aracnakat's Avatar
Aracnakat Aracnakat is offline
 
Join Date: Nov 2001
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okie .. first off, thanks for posting this!! Great stuff!

But I do have a question ... I've installed it but I allow folks to either a) Select an Avatar from those present -OR- b) Upload their own.

Currently the hack is only showing up for those who uploaded their own avatar images. Anyone who selected one of our avatars gets the "noavatar.gif" instead of their selected avatar. (Is there a work around for this?)

Also, I thought for guests I would make the "guestavatar.gif" say just "Please Register" ..

In the code below .. is there a way to link that particular image to the registration page? (I tried, but it didn't work).

PHP Code:
$avatarurl='{imagesfolder}/guestavatar.gif'
You can check out what I've done at my site: Charr The Grimm Fate Forums.

Thanks in advance for any help, I realize that folks have been buggin' the bejesus out of you and wish that I didn't have to.

~Kat
Reply With Quote
  #4  
Old 11-19-2001, 05:54 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, after you installed the above hack, do this.

Instead of this:
Code:
  if ($checkavatar=$DB_site->query_first("SELECT filename FROM customavatar WHERE userid='$bbuserinfo[userid]'"))
    $avatarurl='avatar.php?userid='.$bbuserinfo[userid];
  else
    $avatarurl='{imagesfolder}/noavatar.gif';
use ONLY this:
Code:
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='{imagesfolder}/noavatar.gif';
Next post will have the link you wanted.
Reply With Quote
  #5  
Old 11-19-2001, 05:58 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To make the link you wanted, after you installed the above hack, do this.

Instead of this:
Code:
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='{imagesfolder}/noavatar.gif';
use this:
Code:
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='{imagesfolder}/noavatar.gif';
  $avatarimage='<img src="'.$avatarurl.'">';
AND instead of this:
Code:
  $avatarurl='{imagesfolder}/guestavatar.gif';
use this:
Code:
  $avatarimage='<a href="register.php?s='.$session[sessionhash].'&action=signup"><img src="{imagesfolder}/guestavatar.gif"></a>';
Now in the template, use this:
Code:
$avatarimage
and NOT this:
Code:
<img src="$avatarurl">
Reply With Quote
  #6  
Old 11-19-2001, 06:16 AM
Aracnakat's Avatar
Aracnakat Aracnakat is offline
 
Join Date: Nov 2001
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow .. fast and speedy and good stuff! Thank you very very much.

One problem though ... I know this is going to sound totally stupid, but I couldn't figure out how to properly integrate the three templates: forumhome, forumhome_unregmessage & forumhome_welcometext

So I had to do the following .. which I know isn't what you are supposed to do .. but is how I did it to get it to work ;x (FYI: I tried placing the "avatarurl" image code in both the uregmessage & welcometext but they wouldn't show up .. I would get the broken link box for some reason)

forumhome:
Code:
<!-- top welcome box -->
<table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
$welcometext $unregwelcomemessage
<tr>
	<td bgcolor="{firstaltcolor}" colspan="5"><smallfont><img src="$avatarurl" align="left">
	&nbsp;The time now is $timenow.  You last visited: $bbuserinfo[lastvisitdate].<br>
	&nbsp;There have been <b>$getnewthread[threads]</b> threads and <b>$getnewpost[posts]</b> posts since your last visit!<br>
	&nbsp;$newposts</smallfont></td></tr></table>
<!-- /top welcome box -->
forumhome_unregmessage:
Code:
<td bgcolor="{categorybackcolor}" colspan="5"><normalfont color="{categoryfontcolor}"><b>Welcome to the $bbtitle!</b></normalfont><br>
<smallfont color="{categoryfontcolor}">
	If this is your first visit, be sure to check out the <a href="misc.php?s=$session[sessionhash]&action=faq"><b>FAQ</b></a>. You may have to <a href="register.php?s=$session[sessionhash]"><b>register</b></a>
	before you can post.</smallfont></td></tr>
forumhome_welcometext:
Code:
<td bgcolor="{categorybackcolor}" colspan="5"><normalfont color="{categoryfontcolor}"><b>Welcome back $username!</b></normalfont></td>
</tr>
With your instructions for the "registration link" I think I'd need to put the images under forumhome_unregmessage & forumhome_welcometext -- but don't know why my images won't show up.

(NOTE: It's only the images from avatars which were uploaded which don't show up .. the noavatar.gif and guestavatar.gif seemed to work fine).

Any ideas?

Thanks again for your quick and great work .. if there's no work around for the above problem at least I got the selected avatars to work and that's the most important issue of all!

~Kat
Reply With Quote
  #7  
Old 11-19-2001, 06:48 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Help me help you.
In index.php, where did you place the code for the avatar and everything?
Reply With Quote
  #8  
Old 11-19-2001, 03:56 PM
Aracnakat's Avatar
Aracnakat Aracnakat is offline
 
Join Date: Nov 2001
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doh! I should have thought to list that last night .. okie I put your code and the code for the # of posts here:

Code:
// if user is know, then welcome
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
if ($bbuserinfo['userid']!=0) {
  $username=$bbuserinfo['username'];
  eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  $welcometext = "";
  eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");
}
if ($bbuserinfo['userid']!=0) {
$avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='{imagesfolder}/noavatar.gif';
} else {
  $avatarurl='{imagesfolder}/guestavatar.gif';
}
right above

Code:
$birthdaybits="";
I wasn't sure where it went, so that's probably the problem!

Thanks again.

Donna
Reply With Quote
  #9  
Old 11-19-2001, 04:40 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, let me show you something.
This is what you posted:
Code:
// if user is know, then welcome
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
if ($bbuserinfo['userid']!=0) {
  $username=$bbuserinfo['username'];
  eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  $welcometext = "";
  eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");
}
if ($bbuserinfo['userid']!=0) {
$avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='vbimages/noavatar.gif';
} else {
  $avatarurl='vbimages/guestavatar.gif';
}
You see that the forumhome_welcometext template is being eval() BEFORE the code for the avatar?
That's why it won't show up in that template, because that template is being "called" before you do the avatar thing.

Anyway, I combined some stuff for you. Use this, instead of that block you posted:
Code:
// if user is know, then welcome
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
if ($bbuserinfo['userid']!=0) {
  $avatarurl=getavatarurl($bbuserinfo[userid]);
  if ($avatarurl=='')
    $avatarurl='vbimages/noavatar.gif';
  $username=$bbuserinfo['username'];
  eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";");
} else {
  $avatarurl='vbimages/guestavatar.gif';
  $welcometext = "";
  eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
  eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");
}
Reply With Quote
  #10  
Old 11-19-2001, 08:19 PM
Aracnakat's Avatar
Aracnakat Aracnakat is offline
 
Join Date: Nov 2001
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FireFly,

Thank you ever so much for your time! This ended up working out perfectly for me! AND .. I appreciate the little PhP lesson as well since I didn't even realize that it was calling one thing before the other (this will come in handy in the future as I learn PhP).

Thanks again .. it looks awesome and everyone seems to like it very much!

You are wonderful!

Donna
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10214 seconds
  • Memory Usage 2,282KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (16)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete