Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
customized avatar system Details »»
customized avatar system
Version: , by bharvey42 bharvey42 is offline
Developer Last Online: Mar 2009 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 04-08-2003 Last Update: Never Installs: 0
 
No support by the author.

I have a customized avatar system that stores custom avatars as the users username.gif

Now In the postbit template I would like to be able to display that avatar

$userinfo[username].gif when I use this i get a broken link if the user hasn't uploaded there avatar yet. I made it so it would load a transparent gif and stuck the gif into a table as a background but it repeats if it isn't 66x64.

So what would be the best way to check if the file exists and display it and if not just display the transparent image and fill where the avatar would be?

This does not use vB's avatar field so simply checking the usersinfo on the user won't work.

Thanks

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-10-2003, 05:09 AM
jakoz jakoz is offline
 
Join Date: Feb 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if (file_exists("some.file")==1) {
doStuff();
}
Reply With Quote
  #3  
Old 04-10-2003, 05:19 AM
bharvey42 bharvey42 is offline
 
Join Date: Jan 2002
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should work if I have the hack that allows me to use php in the templates?
Reply With Quote
  #4  
Old 04-10-2003, 01:20 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you'll have to hack functions.php

or i think a htaccess way will work to, like a 404 error just if an img file doesn't exists use another one, but i don't know if this really possible, i just think so
Reply With Quote
  #5  
Old 04-11-2003, 03:42 PM
jakoz jakoz is offline
 
Join Date: Feb 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in admin/functions.php

find:

if ($post[avatarid]!=0) {
$avatarurl=$post[avatarpath];
} else {
if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
} else {
$avatarurl="";
}
}



comment that out and put:

if ((file_exists("$userinfo[username].gif ")==1) && $avatarenabled) {
$avatarurl="$userinfo[username].gif";
} else {
$avatarurl="";
}
}


you should then not have to make any template changes at all from the original to display this avatar instead. remember to get rid of the !($bbuserinfo[showavatars]) bit on the line below it if you havent tied this system in with the users showavatar variable. forgive any errors... been up for 2 days with a busted jaw

hope that helps
Reply With Quote
  #6  
Old 04-11-2003, 04:41 PM
bharvey42 bharvey42 is offline
 
Join Date: Jan 2002
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for all the responses. I ended up figuring this out with my old code that I had for the avatar system, with some assistance from another person who was up at 4:30 am in the vB chatroom
Reply With Quote
Reply

Thread Tools

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 07:35 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.04071 seconds
  • Memory Usage 2,233KB
  • Queries Executed 19 (?)
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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete