The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
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');
$avatarurl = fetch_avatar_url($vbulletin->userinfo['userid']);
vB_Template::preRegister('MEMBERINFO', array('avatarurl' => $avatarurl[0]));
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! |
|
#2
|
|||
|
|||
|
What hook are you using for your plugin?
|
|
#3
|
||||
|
||||
|
$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.
|
| Благодарность от: | ||
| findingpeace | ||
|
#4
|
||||
|
||||
|
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?
|
|
#5
|
|||
|
|||
|
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
require_once('./includes/functions_user.php');
$avatarurl = fetch_avatar_url($vbulletin->GPC['userid']);
vB_Template::preRegister('MEMBERINFO', array('avatarurl' => $avatarurl));
|
|
#6
|
||||
|
||||
|
Thank you so much tbworld! I am out of "Likes" to give you
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|