PDA

View Full Version : I want the avatar url


SilverBoy
12-17-2016, 07:01 PM
Hi

I have a plugin which is grab the avatar url for CMS articles, I don't know why, the plugin give me the Thump link not the actual link, so what do you suggest?
here is the code

require_once(DIR . '/includes/functions_user.php');
$avatarurl = fetch_avatar_url($view->authorid, true);
if ($avatarurl[0]) {
$avatarurl = $avatarurl[0];
}
/* render template and register variables */

$view->avatarurl = $avatarurl;
Thanks in advance.

Lynne
12-17-2016, 08:33 PM
You may want to have a link to the api - https://members.vbulletin.com/api/

According that that, you want to change true to false in the fetch_avatar_url function . True gives the thumbnail, false does not.

SilverBoy
12-17-2016, 11:47 PM
Thank you Lynne
Actually I don't know how to use the api.
and in function fetch_avatar_url the default value for thump=false !!
btw I changed this line in this function
$avatarurl[] = $vbulletin->options['avatarurl'] . ($thumb ? '/thumbs' : '') . "/avatar{$userid}_{$avatarinfo['avatarrevision']}.gif";
by removing thump stuff !!
$avatarurl[] = $vbulletin->options['avatarurl'] . "/avatar{$userid}_{$avatarinfo['avatarrevision']}.gif";
Now it works like I want, but I'm worry if this change affect any avatar existing in the forum, because I want the full size only in the CMS articles.
Thanks.

Lynne
12-18-2016, 04:41 PM
Thank you Lynne
Actually I don't know how to use the api.
and in function fetch_avatar_url the default value for thump=false !!

I know it's default is false, but you set it to true here:
$avatarurl = fetch_avatar_url($view->authorid, true);

So, either set it to false or remove the comma and true and let it default to false.
$avatarurl = fetch_avatar_url($view->authorid);

SilverBoy
12-18-2016, 06:51 PM
Thank you, I will give it a try :)

--------------- Added 1482095034 at 1482095034 ---------------

It works great, thanks Lynne :)