Log in

View Full Version : Finding Avatar Paths


Zizou_SCD
03-18-2008, 03:15 PM
Hey guys,

As you can see from the thread title, I am trying the path to a persons avatar.

I am trying to ouput a persons avatar onto a webpage, NOT within vBulletin.

So what I need is a query to bring back a path to the avatar when a username is supplied.

Does anyone have this sort of query?

Brandon Sheley
03-18-2008, 06:04 PM
Why would you want to do this ?
Can you just right click on the image and check the path ?

like here..

https://vborg.vbsupport.ru/

Jase2
03-18-2008, 06:29 PM
Usually in the database, unless you have moved it to the file system, in which case it would be something like this:

/forum/customavatars

Regards Jason :)

Zizou_SCD
03-18-2008, 10:21 PM
Why would you want to do this ?
Can you just right click on the image and check the path ?

like here..

http://www.vbulletin.org/custompics/forum/avatars/avatar80028_6.gifMaybe I want to output user information from vBulletin on a webpage that's outside vBulletin :p I am creating website using a CMS and need to use the avatars from vBulletin on the site.

Usually in the database, unless you have moved it to the file system, in which case it would be something like this:

/forum/customavatars

Regards Jason :)I know where they are exactly in the file system. I need a query to take a username and bring back the exact url to the image.

Any ideas anyone?

Lynne
03-18-2008, 11:44 PM
How are you getting the username? Are you calling any standard vb files in the page? The reason I ask is that you may already have the avatar available to you already depending on the coding on your page.

Zizou_SCD
03-19-2008, 09:10 AM
I am not linking to any vBulletin files. It's an unfeasible solution to the problem.

I have a piece of PHP code which is printing the 5 latest topic titles with the last post and poster name.

I want to get the last posters avatar in on the act here as well.

The query I have at the moment is:

select a.*, b.pagetext, b.postid from vb_thread a inner join vb_post b on a.lastpostid = b.postid order by a.lastpost desc limit 0,5;

Is there a simple way to adapt with query to bring back an avatar path as well?

Lynne
03-19-2008, 03:02 PM
Are you adverse to using some vb code? I found that there is a function called "fetch_avatar_url" in the includes/functions_user.php file. You pass the userid and it passes back the avatar_url. It's around line 260 of that file. Will that work for you?

Boofo
03-19-2008, 03:11 PM
fetch_avatar_url is great is you are only trying to get one avatar, but it will do a query for each avatar is pulls.

Zizou_SCD
03-19-2008, 04:11 PM
Are you adverse to using some vb code? I found that there is a function called "fetch_avatar_url" in the includes/functions_user.php file. You pass the userid and it passes back the avatar_url. It's around line 260 of that file. Will that work for you?To be honest, I thought it would be to difficult to use the vBulletin code in my set up.

Say I have home.php, all it outputs is one div with 5 topic titles, last poster name, and bit of text from the last post (I'll attach the code of the example page). Obviously in the real example there is more on my page, but for the sake of this topic jsut use the home.php I made up. How would the attached code be altered so that I could use the fetch_avatar_url function?

Thanks for all the help so far guys by the way.

Lynne
03-19-2008, 07:42 PM
I have a 'home' page for my site. I read this article to help me make it: https://vborg.vbsupport.ru/showthread.php?t=62164 This allows me to use a vb template to put the 'meat' of my homepage and to use the header and footer templates to make it have the same style as my site. Since I am using the vbulletin global script in it, I have access to all sorts of variables and my guess is it would make your page a lot easier to do if you used it.