![]() |
Why doesn't this code to display avatars work?
I'm trying to display avatars (hosted in the filesystem) on a non-vb page. Basically, I'm supplying a userid and want to display the avatar...
PHP Code:
From all the examples I've read it seems like this *should* work, am I making a stupid mistake? Any help is appreciated! --------------- Added [DATE]1239745335[/DATE] at [TIME]1239745335[/TIME] --------------- also, just to be clear this file resides in my vbulletin directory so the path to functions_user.php should be good. |
anybody? is there another solution to display avatars that are NOT hosted in the database on a non vb page?
|
Exactly what is getting displayed in the source code? And maybe it would be better to go:
PHP Code:
|
^^ I think we're basically doing the same thing there?
When i try to run this and print the results using "echo $avatarurl;" for example I get nothing. It doesn't display noavatar.gif which should display if $avatarurl is empty. I can replace, $avatarurl = fetch_avatar_url($avatarid); with $avatarurl = 1; and the script runs and I can display the results (which are 1), so my issue lies with the fetch_avatar_url($avatarid); portion which doesn't seem to be pulling the info it's supposed to. Do I need to include other files to access that function? |
Did you look at the API for that function? I believe it returns an array. Is $avatarurl defined as an array? According to the API, that is the correct file to include.
|
Yeah looking at the API is where I got most of this code.
The if statement should deal with the array, basically saying if there is a value for $avatarurl[0] assign it to $avatarurl, otherwise gave $avatarurl the value "noavatar.gif" |
Try a
Code:
print_r($avatarurl); |
^^ Tried it, I think $avatarurl = fetch_avatar_url($avatarid); just isn't working :confused:
|
Did you try looking in the vb code to find a some code where this function is and then just copying it?
And, if $avatarurl is defined as an array, you can't then just go use it as if it isn't an array. |
Quote:
$avatarurl is an array, but I am using it as one... $avatarurl[0] would access the first element in the array which should be the URL for the avatar. |
All times are GMT. The time now is 01:29 PM. |
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:
|