Log in

View Full Version : Badges


LordHelmut
10-17-2002, 01:56 AM
<a href="http://www.visualbasicforum.com" target="_blank">www.visualbasicforum.com</a> uses a hack one of the members wrote where the administrators can give different badges to members. They have a leader badge to show whose a helpful person on the forum, a guru badge to show who can figure most stuff out, and a badge for moderators and admins. I have attached a screenshot to show how it looks, how hard would this be to write?

Dean C
10-17-2002, 05:14 PM
looks nice :D

Ask for someone to make it in the "Requests" forum :D

- miSt

etones
10-19-2002, 12:30 PM
I;ve seen a hack like this posted already. You can assign a littke 13x13 pixel image with users...

Search the hacks forum

LordHelmut
10-19-2002, 04:29 PM
Do you have any idea what it might be called? I looked but there are so many I can test them all.

Neo
10-20-2002, 12:00 PM
Sigh....https://vborg.vbsupport.ru/showthread.php?s=&threadid=44593

Dean C
10-20-2002, 02:27 PM
^ that isn't it neo..

- miSt

Ninth Dimension
10-20-2002, 10:41 PM
you might be able to use the awards hack on this site, just do a search for it :)

LordHelmut
11-09-2002, 11:19 PM
Well, it seems no one is accepting. I was told that basically it would just be displaying a image to the right of the names and some other minor edits. This would be a really cool hack to do. I know people wonder if any hacks are left, well here is one that no ones doing :(

Erwin
11-10-2002, 03:10 AM
You don't really need a hack to do this.

Create a new custom profile field. Call it "Badge". Set it to NO in all options (not customizable by member, not seen in profile etc.)

Find out what the custom profile id number is by putting your mouse over the link to edit it, and looking at the number at the end.

Then, in your postbit template, add this:

<img src=$post[fieldx]>

where you want the "badge" to show up. Replace x with the custom profile id number.

You can do the same for the user's profile - in the "getinfo" template, add this:

<img src=$userinfo[fieldx]>

where you want the "badge" to show up too.

Then, when you want to give a "badge" to a member, go to your Admin CP, edit the user profile, and in that "Badge" custom profile space, put in the full URL to that image. You can use different images for different badges.

Done! :)

LordHelmut
11-10-2002, 04:17 AM
It works great man! :) Thank you sooo much. There is however one problem. For some reason on everyone who DOESNT have a badge image linked in that field, it puts the little square with the red X (symbolizing no image to load) next to their name. How do I fix this?

Erwin
11-10-2002, 04:38 AM
That requires hacking.

Open admin/functions.php -

Find:


$post[joindate]=vbdate($registereddateformat,$post[joindate]);


Underneath, add:


if ($post[fieldx]=="") {
$badge = "";
} else {
$badge = "<img src=\"$post[fieldx]\">";
}


Replace x with the custom profile field id number.

Then in your postbit template, use $badge instead of the <img src> code for the badge to show up.

Do the same in member.php.

Find:


// display user info


Underneath, add:


if ($userinfo[fieldx]=="") {
$badge = "";
} else {
$badge = "<img src=\"$userinfo[fieldx]\">";
}


Replace x with the custom profile field id number.

Then in your getinfo template, use $badge instead of the <img src> code for the badge to show up.

Done! :)

Erwin
11-10-2002, 04:41 AM
Refresh this page - I fixed a small typo in the code. :)

LordHelmut
11-10-2002, 04:52 AM
OMG ITS PERFECT ^_^ Thats really cool man. No one else could get it to do it they way I really wanted but you did it with apparently little effort. One more small question, what file do I edit if I want the image to appear in the Members Online box on the main page?

Erwin
11-10-2002, 05:06 AM
That would require editing index.php and making the $loggedins=$DB_site->query JOIN to the field table on top of the user table - this may slow your index.php down a bit. It can be done, but will take some working out. Do you really need it? Wouldn't the graphic be too big?

LordHelmut
11-10-2002, 05:10 AM
I really would like to do it. I had orignally just planned on doing that rather than what you showed me how to do. However I really like what you showed me so I added that too. check out www.VisualBasicForum.com it doesnt seem to slow down their load page at all. If its too difficult its ok, I will figure it out somehow :)

Erwin
11-10-2002, 05:37 AM
If you just want an icon to show up for staff, you can do this:

Open index.php -

Find:


$username = "<b><i>$loggedin[username]</i></b>";


Replace with:


$username = "<b><i>$loggedin[username] <img src=\"http://www.yourforums.com/images/admin.gif\"></i></b>";


THE CODE APPEARS TWICE - DO THIS TWICE!

This is for the ADMIN icon. Change the image path to whatever you want.

Then, find:


$username = "<b>$loggedin[username]</b>";


Replace with:


$username = "<b>$loggedin[username] <img src=\"http://www.yourforums.com/images/mod.gif\"></b>";


THE CODE APPEARS TWICE - DO THIS TWICE!

This is for the MODERATOR icon. Change the image path to whatever you want.

For this to work, you need to set in Admin CP, vB Options, for the staff username bold and italics to ON.

As for other users, like I said, it's a JOIN feature if you use the custom profile method.

I think there is a hack that allows members to have small icon next to their username on the homepage. Maybe modify that for your purposes.

Erwin
11-10-2002, 05:45 AM
It's this hack:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=44593

See if you can modify it so that admins are the only ones who can add the image.

esawdust
11-10-2002, 04:44 PM
Love the hack! I am using this to present contractor certification badges by outside associations. Is there any way to hyperlink the image (badge) from the postbit template or the admin user profile screen?

I would also like to be able to add additonal badges (say 3).. I should be able to just repeat the hack using an additional profile field.. (something like $badge, $badge1, $badge2) correct?

Thanks for the great hack.

Greg

esawdust
11-14-2002, 01:55 PM
Allow me to clarify..

I already have the bades hack installed and its working great. We run a wood care contractors site and each contractor that is certified by a secific organization is allowed to post their certification logo. What I would like to do is create another form of advertising by enabling the logo to be linked to the each of the organizations websites. So in other words a contractor interested in getting their certification with organization "A" could click on another users badge to bring them that "A" 's website.

Any ideas? \

Thanks!

Greg

esawdust
11-17-2002, 03:06 AM
bump

Jacko
04-27-2003, 07:15 PM
i just tried to do this to my other board and i got the following error but your code is no where near line 915.

this is what i get:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/realmods/public_html/forum/admin/functions.php on line 915

Fatal error: Call to undefined function: vbsetcookie() in /home/realmods/public_html/forum/admin/sessions.php on line 204

and the code on line 915 is:

$buffer = str_replace(""", "\"", $buffer);

any ideas??

Harlequin
09-17-2003, 04:32 PM
What if we were to make this option available to everyone in their profile and allow each and every person on the board have a customized icon? -- whatever they'd prefer to have beside their name in the postbit.



While it's no deal to actually have that happen, the real problem comes in when the user may use an image larger than such and such height and width. How can this be limited to or resized only to.. say, 20x20?

<edit>

20x20 without using <img height= width=>. ;)