vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom Rank System (https://vborg.vbsupport.ru/showthread.php?t=122964)

viper2k6 08-03-2006 11:56 PM

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.

pyro.699 08-04-2006 12:03 AM

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'); 


viper2k6 08-04-2006 12:10 AM

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.

pyro.699 08-04-2006 12:39 AM

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']; 


viper2k6 08-04-2006 01:08 AM

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.

peterska2 08-04-2006 01:25 AM

are your avatars and attachments stored as files or in the database?

viper2k6 08-04-2006 01:29 AM

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.

peterska2 08-04-2006 01:35 AM

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

viper2k6 08-04-2006 01:42 AM

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.

pyro.699 08-04-2006 09:58 AM

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


All times are GMT. The time now is 08:00 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.01111 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)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
  • (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