PDA

View Full Version : Avatar Hack v0.8 released


06-06-2000, 02:53 AM
Hi all

OK, at long last, I think this is ready for everyone else to poke at :)

To make things easier, I've put the instructions up on my site, using a program someone gave me a long time ago that's designed specifically for posting hacks with. At one point I thought about doing a PHP version of it, I guess I have motivation now :)

This release is still not completely clean. There are a few things not yet coded that I want to get in before it makes it to 1.0. the to-do list is:


Allow Private Avatars
Allow usergroup-wide Avatars (like the custom usertitles)
Clean up the template work for when Avatar images isn't running. Right now, if $avatarshow is off, the templates will display the start of the selector, just with no images. This is mostly because the way the table row formatting gets tweaked adding in the selector, it's easier to just put the blank there.


As always, use at your own risk. It's recommended you back up your vB PHP files before implementing this hack. The database modifications won't affect anything if you back the hack out.

Anyway, you can find the instructions for applying the hack at http://www.moonwolf.net/cgi-bin/vb_mods/avatar/instructions.cgi

To see it in operation, I have a version of it running at http://www.underlight.com/VBB

Enjoy!

Kath

[Edited by Moonwolf on 06-06-2000 at 12:04 PM]

06-06-2000, 02:59 AM
Hmm, was a problem with the [url] tags ... all better now.

Kath

[Edited by Moonwolf on 06-06-2000 at 12:05 PM]

06-06-2000, 03:11 AM
OK< I found one bug.

if you edit a user's Avatar through the admin panel selector, it enters the avatarsid # into the user's Avatar record, rather than the path.

I'll work a fix. In the meantime, this won't affect users selecting their own Avatar from the register and profile screens, only if you admin panel edit them.

Kath

06-06-2000, 03:23 AM
Umm.. I got a 403 error when I copied the URL from the instructions and pasted them into lynx.

Shri

06-06-2000, 03:27 AM
Fixed, sorry about that

Note to self: Don't write instructions at 4am in the morning after pulling an all-nighter :P

Kath

06-06-2000, 03:30 AM
*grin* moved up one notch from a 403 error to a 404 (file not found) :)

06-06-2000, 03:36 AM
Did you reload instructions.cgi to get the new URL?

Kath

06-06-2000, 03:38 AM
Nice hack :)

I like this idea. I just wish it could upload with restrictions to size and weight, but I think that would require an extra table and profile field.

I think it could be done without that, though, if the icons were referenced from an upload directory and forced to be named username.gif

I ramble...

nice hack :)

06-06-2000, 03:55 AM
Applied the hack .. not a problem.

Now, I get a javascript error when I go to modify my profile on member.php

Line 10
Char 1
Error: 'document.dynamicselector.dynamicselector2' is not an object

Any ideas?

06-06-2000, 04:11 AM
OK, that one is definately a bug on my part :)

In all of the selector templates, where it says

<FORM ACTION=


Replace with:

<FORM name=preferences ACTION=


Then edit avatar.js, and change

document.dynamicselector.dynamicselector2


To:

document.preferences.avatar


My fault, I uploaded the wrong .js file, sorry :(

I've changed instructions.cgi and uploaded a new .zip file with the correct avatar.js file in it.

The admin editing problem has me stumped though. The syntax should br bringing up the avpath, but it's not, it's bringing up the avatarsid ...

I'll keep battling it.

Sorry I'm a klutz with documentation :(

Kath

[Edited by Moonwolf on 06-06-2000 at 01:22 PM]

06-06-2000, 04:18 AM
Fixed the javascript problem...

In the modifyprofile template...

Call the form "dynamicselector"

Call the avatar selection box "dynamicselector2" and it will be compatible with the avatar.js thats in the hack.

06-06-2000, 04:20 AM
Ok, both would work. I was checking my fix while you must have been adding the updated instructions.

Cannot display the avatar with my posts .. looking at it as we speak.

06-06-2000, 04:24 AM
OK, once the hack is in, you need to set avatarshow in options to yes, and make sure you have $avatar in your postbit template.

06-06-2000, 04:38 AM
Ok, fixed the problem where the database was not getting updated.

That was due to my mod on the javascript.

Now looking into why userinfo[avimage] is a null value in showthread :)

06-06-2000, 04:44 AM
I think you missed one step in the mod for showthread.php

Change

$userinfo=$DB_site->query_first("SELECT userid,email,username,usertitle,signature,showemai l,homepage,icq,aim,yahoo,joindate,posts FROM user WHERE userid=$userid");

To this ... (add the avimage into the select statement)

$userinfo=$DB_site->query_first("SELECT userid,email,username,usertitle,signature,showemai l,homepage,icq,aim,yahoo,joindate,posts,avimage FROM user WHERE userid=$userid");


Before you add this piece...

/* Avatar Hack by Moonwolf */
if ($userinfo[avimage] and $showavatars==1 and is_file($userinfo[avimage])) {
clearstatcache();

06-06-2000, 04:44 AM
One of the things I'm looking at for 1.0 is a toggleable user upload of private images. That will have a byte size restriction on it. As for display dimensions, those can be controlled by $aheight and $awidth through the control panel.

Kath

Originally posted by Martin
Nice hack :)

I like this idea. I just wish it could upload with restrictions to size and weight, but I think that would require an extra table and profile field.

I think it could be done without that, though, if the icons were referenced from an upload directory and forced to be named username.gif

I ramble...

nice hack :)

06-06-2000, 04:54 AM
Yep, I did, thanks for finding it.

I've changed the templates a little bit, and the avatardb.php file that inserts the first image also. Now the selector will default to ----- None ----- if there's no image set. Makes it a little cleaner. In each of the three templates that have the selector, delete the <option>'s that are in the template, and let the PHP do all the work filling them out.

Kath

Originally posted by shri
I think you missed one step in the mod for showthread.php

[Edited by Moonwolf on 06-06-2000 at 01:59 PM]

06-06-2000, 04:58 AM
Nice - John can you get this added to a release when it is all smoothed out?

06-06-2000, 09:20 AM
Hi,

great hack - but the download-link on moonwolfs instructions doesn't work - could anyone attach this on an email to me?

Thanx - this is the hack for vB!

06-06-2000, 09:34 AM
I'm not sure, but there seems to be something wrong with the dHTML in the selector. In Netscape, it refuses to display any form elements after the selector, and refuses to display the images.

-Why- this is happening I have no idea, but I'm working on it. It doesn't affect MSIE at all.

TB2: Try the link now.

Kath

06-06-2000, 11:11 AM
Kath,

i've just implemented your hack - works great (only on the registration page there are no images shown - on the modify profile they are all shown correctly. I've checked your install docs and my templates more than once ... hmmm ...) !

A suggestion: I'm using a simple cgi-script for image-uploads what works fine - the perfect thing would be:

The user could choose an avatar in his profile like in your hack but additionally: If the user chooses "none" he could optionally enter an url to his avatar in an additional field ... if he chooses a "predefined" one - the entry in the URL-Field would be ignored ...

Possible?

06-06-2000, 12:48 PM
TB2:

I'll check the register thing out in the morning. I'm in the middle of doing the private avatar with user uploads version, and trying to fix the dHTML in Netscape problem, so I'll add it to the list.

As far as allowing users to enter avatars held off site, I think most site operators would be hesitant, because of image dimension and load times concerns.

Kath

06-06-2000, 11:44 PM
Great going sofar :)
* will wait patiently till the final version, and avoind messing up his vB, again ;)