![]() |
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. |
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:
|
so some like:
Code:
ob_start(); |
oh :)
ok, since this will be used many times (once per post), use PHP Code:
|
I tried it in a plugin and it just spit out all of the php imaging code (weird characters, etc):
ÿÛ¸Ù&DPÃ"¸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. |
are your avatars and attachments stored as files or in the database?
|
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. |
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 |
Quote:
|
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 |
Cool, now it seems to work perfectly. My next question is as far as optimization, is it more efficient to point to a dynamic php image file or would it be better to have a plugin with a query to retrieve the image url instead ... thanks for all of the quick responses!
|
This may not be what your looking for but i am an admin on oxy-moron.net. And what we did for ranks was we used the user ranks option in the Admin CP, along with the Promotions option to facilitate that.
Basically you have a usergroup for each rank you want, the images are stored on the server. Then you go to the User Ranks Menu on the left hand side. Choose Add new rank, Choose the usergroup your applying it to, If your having multiple different ranks on one user choose Yes for Stack Rank, if that is their only rank choose No. Put in the path to the image and click submit. Then to assign someone a new rank you can just go into their ser account and change their usergroup, their image will automatically change no coding needed. I also came up with a way of using the Promotions option to automatically advance someone from a registered user to whatever the lowest rank is. Our system originally was using a Army Rank structure, and all new registered people were Recruits. So the User Promotions option allowed us to automatically advance someone to recruit without having to change the usergroup on every new member |
All times are GMT. The time now is 10:44 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|