![]() |
Getting user avatar URL?
I try to use the official avatarurl because it has the dateline built in (so stuff doesn't get stuck in cache when people update their avatar), but it's not in a lot of templates. So I've tried making a plugin to make it work manually, but I'm having some trouble.
Example with MEMBERINFO: Code:
require_once('./includes/functions_user.php'); Code:
{vb:raw avatarurl} What I need is for the user ID to match the user ID of the profile I'm viewing. So if I'm user 1, and I view user 5's profile, I should see user 5's avatar, not my own. Thanks! |
What hook are you using for your plugin?
|
$vbulletin->userinfo holds the userid of the user browsing the page (in this case: you). You need to get the id of the user who owns the profile. What variable to use depends on the hook you use.
|
I'm just using global_start so I can register the variable in multiple templates. Is this wrong? How would you recommend I do this just do display on MEMBERINFO, for example?
|
The only problem you are having is your target. As @Cellarius stated the variable you are trying to use is incorrect.
The following will work in MEMBERINFO template, although I did not check the dateline param which I should have added -- if possible. Code:
<img src="{vb:raw vboptions.bburl}/image.php?{vb:raw session.sessionurl}u={vb:raw show_userid}" /> --------------- Added 29 Jul 2014 at 22:04 --------------- The hook code works fine. I had missed creating an actual avatar for the test user. :) That stuff happens when you are juggling too many things. Code:
//Hook: member_complete |
Thank you so much tbworld! I am out of "Likes" to give you :)
|
All times are GMT. The time now is 02:17 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:
|