Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2006, 11:56 PM
viper2k6 viper2k6 is offline
 
Join Date: Jun 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Rank System

I'm trying on working on having a custom user avatar underneath the regular vbulletin avatar. The custom avatar is retrieved with a dynamic php script (getavatar.php?account=1) which is associated with each users forum id.

I was wondering what is the best way to insert this into the postbit template for each user. I know I can get the user id using $post[userid], I'm just now sure on how to include it. Any help is appreciated.
Reply With Quote
  #2  
Old 08-04-2006, 12:03 AM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

id use plugins. and just put your code in the plugin.

hooklocation: postbit_complete

or something like that.

(if you like having a file try...)
PHP Code:
require_once('./some/dir/file.ext'); 
Reply With Quote
  #3  
Old 08-04-2006, 12:10 AM
viper2k6 viper2k6 is offline
 
Join Date: Jun 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so some like:

Code:
ob_start();
include('./getavatar.php?account=$post[userid]');
$getavatar = ob_get_contents();
ob_end_clean();
The only question is what's the correct reference to get (call) the poster's userid in a plugin.
Reply With Quote
  #4  
Old 08-04-2006, 12:39 AM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh

ok, since this will be used many times (once per post), use
PHP Code:
global $db;
global 
$vbulletin;
//im not sure if these are required, i include them in all my plugins though
$postersUserid $post['userid']; 
Reply With Quote
  #5  
Old 08-04-2006, 01:08 AM
viper2k6 viper2k6 is offline
 
Join Date: Jun 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it in a plugin and it just spit out all of the php imaging code (weird characters, etc):

ÿÛ¸Ù&D•PÃ"¸sÃ0¶eÓÛc|¢~Sô¬¡˜SnÒÐ x‰^:œÊ¸n”êϙå‚BŒ¥]N<µë*ûúW~ç5Q@Q@Q@Q@Q@€<45½\]Ý'ú£lô‘û/øû}kÜmȽf'þ=ã8Ç÷y'D²Ó`P'“€ï# W K;Híã<"ã=ϽgV|ˆÒœ9™=ÅÈAÚ±îo9ç‘é PÜÝõæ±înúó^eJÇ|)–ój3J¢å

I tested the image in a post doing [img]getavatar.php?account=1[/img] which display fine. But if I try using a <img src="getavatar.php?account=$post[userid]"> in the postbit template, it doesn't allow it. Is there a setting to allow dynamic php images (files ending in ? or &) within a template?

If use the <img src="getavatar.php?account=$post[userid]"> and view the source code, it correctly lists the <img src="getavatar.php?account=1">, but it doesn't display the image.
Reply With Quote
  #6  
Old 08-04-2006, 01:25 AM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

are your avatars and attachments stored as files or in the database?
Reply With Quote
  #7  
Old 08-04-2006, 01:29 AM
viper2k6 viper2k6 is offline
 
Join Date: Jun 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They are stored as files and are assigned in a seperate database/table:

userid | avatarurl

I use the userid as a reference between the vbulletin user table and my customavatar database. I then create a php script which retrieves the userid and display the appropriate image:

Example: If I use <img src="getavatar.php?account=1"> in a standard php document, it displays it perfectly.

The problem comes as I stated in the previous post. Correctly shown in the source code, but not displayed.
Reply With Quote
  #8  
Old 08-04-2006, 01:35 AM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ah, In the vBOptions > Message Posting and Editing Options > Allow Dynamic URL for [IMG] Tags

Try setting that to YES and see if it makes any difference
Reply With Quote
  #9  
Old 08-04-2006, 01:42 AM
viper2k6 viper2k6 is offline
 
Join Date: Jun 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
ah, In the vBOptions > Message Posting and Editing Options > Allow Dynamic URL for [IMG] Tags
I did enable that option, and if I try [img]getavatar.php?account=1[/img] in a post the image shows up perfect...however the <img src="getavatar.php?account=1"> in the postbit template, doesn't display an image at all - but upon viewing the source code, it's referenced correct.
Reply With Quote
  #10  
Old 08-04-2006, 09:58 AM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hrm, that sounds prety odd. and makes little sence. because if [img] works, then so should <img>.i would just check to make sure everything is spelled right. if it still dosent work. View the source when you use [img] and compare it with <img>. Hope this helps

~Cody Woolaver
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 11:40 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.04451 seconds
  • Memory Usage 2,249KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (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