PDA

View Full Version : need help with avatarrevision


ye22
05-09-2014, 01:15 PM
hey all.. i need help getting "$loggedin[avatarrevision]" to work in Template: "forumhome_loggedinuser"
As when i use it in that template it just doesn't return any value at all.

Thanks in advanced.

Lynne
05-09-2014, 04:31 PM
Is that variable even defined there? Located where the template is rendered in the files (do a global search in the vbulletin directory for it) and then look at the code above where the template is rendered. Do you see that variable defined? If not, you will need to write a plugin to define it first before you can use it.

You could *try* adding this line to your config.php file after the <?php and see if it works, but I am guessing it won't but it's worth a try.
// Force all userinfo queries to include avatar information.
define('AVATAR_ON_NAVBAR', 1);

ye22
05-09-2014, 06:05 PM
and how to make such plugin?
sorry but i'm bad in such stuff :/
i tried the config.php thing but it didn't work.

kh99
05-09-2014, 07:59 PM
Try creating a plugin using hook location forumhome_loggedinuser_query and this code:
$hook_query_fields .= ", user.avatarrevision ";

ye22
05-09-2014, 08:13 PM
Try creating a plugin using hook location forumhome_loggedinuser_query and this code:
$hook_query_fields .= ", user.avatarrevision ";

tried.. but still :/

http://i.imgur.com/L5kcU8k.png
http://i.imgur.com/6O4ZP2W.png

the "$loggedin[avatarrevision]" doesn't output anything :/

Lynne
05-09-2014, 08:59 PM
Have you looked at the database to verify it is there? Have you tried disabling all other plugins to make sure it isn't a plugin conflict? Are you looking at the correct style on your site?

kh99
05-09-2014, 09:13 PM
OK, you need an additional plugin because the current user is handled differently. Use hook location forumhome_loggedinuser and code:
if ($loggedin['userid'] == $vbulletin->userinfo['userid'])
{
$loggedin['avatarrevision'] = $vbulletin->userinfo['avatarrevision'];
}

ye22
05-09-2014, 09:19 PM
Have you looked at the database to verify it is there? Have you tried disabling all other plugins to make sure it isn't a plugin conflict? Are you looking at the correct style on your site?

Well..
i was using : https://vborg.vbsupport.ru/showthread.php?t=269031&highlight=XFAvatar
for the avatar thing.. and yea i am tring to disable other plugins atm(as i am using alot of them) but still.
and about the style.. yea i am sure about it.

--------------- Added 1399674133 at 1399674133 ---------------

OK, you need an additional plugin because the current user is handled differently. Use hook location forumhome_loggedinuser and code:
if ($loggedin['userid'] == $vbulletin->userinfo['userid'])
{
$loggedin['avatarrevision'] = $vbulletin->userinfo['avatarrevision'];
}

IT WORKS!! :D
Thanks alot dude! :)

--------------- Added 1399729498 at 1399729498 ---------------

Just asking.., is it the same with "avatarid" and "hascustom"? :D
i mean.. how to check if user has an avatar or not? :/

kh99
05-10-2014, 05:01 PM
I guess to get all the avatar info, for the first plugin it would be something like:
$hook_query_fields .= ", user.avatarrevision, avatar.avatarpath, customavatar.dateline AS avatardateline, customavatar.width AS avatarwidth, customavatar.height AS avatarheight, NOT ISNULL(customavatar.userid) AS hascustomavatar ";
$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid)
LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)";


then in the second , maybe:
if ($loggedin['userid'] == $vbulletin->userinfo['userid'])
{
$loggedin['avatarrevision'] = $vbulletin->userinfo['avatarrevision'];
$loggedin['avatarpath'] = $vbulletin->userinfo['avatarpath'];
$loggedin['avatardateline'] = $vbulletin->userinfo['avatardateline'];
$loggedin['avatarwidth'] = $vbulletin->userinfo['avatarwidth'];
$loggedin['avatarheight'] = $vbulletin->userinfo['avatarheight'];
$loggedin['hascustomavatar'] = $vbulletin->userinfo['hascustomavatar'];
}


But I haven't tried it, so I don't know if all those fields are there for the current user (but I think they should be).

ye22
05-10-2014, 11:26 PM
I guess to get all the avatar info, for the first plugin it would be something like:
$hook_query_fields .= ", user.avatarrevision, avatar.avatarpath, customavatar.dateline AS avatardateline, customavatar.width AS avatarwidth, customavatar.height AS avatarheight, NOT ISNULL(customavatar.userid) AS hascustomavatar ";
$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid)
LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)";


then in the second , maybe:
if ($loggedin['userid'] == $vbulletin->userinfo['userid'])
{
$loggedin['avatarrevision'] = $vbulletin->userinfo['avatarrevision'];
$loggedin['avatarpath'] = $vbulletin->userinfo['avatarpath'];
$loggedin['avatardateline'] = $vbulletin->userinfo['avatardateline'];
$loggedin['avatarwidth'] = $vbulletin->userinfo['avatarwidth'];
$loggedin['avatarheight'] = $vbulletin->userinfo['avatarheight'];
$loggedin['hascustomavatar'] = $vbulletin->userinfo['hascustomavatar'];
}


But I haven't tried it, so I don't know if all those fields are there for the current user (but I think they should be).

IT WORKS TOO!

Thanks dude!!