MarkFL
03-17-2017, 06:38 PM
On one of the sites I help admin, we discovered that a lot of users' profile pics weren't showing up on their profiles. All the permissions were set correctly, and the filesize limitations are quite liberal and not the issue.
Anyway, I couldn't figure out why they weren't being returned in the $prepared array, so I wrote a plugin that I thought others might find helpful.
The Hook Location is "member_build_blocks_start" and the Plugin PHP Code is:
if (!$prepared['profilepicurl'])
{
global $vbulletin;
$ppuserinfo = fetch_userinfo($prepared['userid'],8);
if ($vbulletin->options['usefileavatar'])
{
$ppuserinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' . $ppuserinfo['userid'] . '_' . $ppuserinfo['profilepicrevision'] . '.gif';
if (!file_exists($ppuserinfo['profilepicurl']))
{
$ppuserinfo['profilepicrevision'] = 0;
}
}
else
{
$ppuserinfo['profilepicurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $ppuserinfo['userid'] . "&dateline=$ppuserinfo[profilepicdateline]&type=profile";
}
if ($ppuserinfo['profilepicrevision'] OR $ppuserinfo['profilepicdateline'])
{
$prepared['profilepicurl'] = $ppuserinfo['profilepicurl'];
}
}
Anyway, I couldn't figure out why they weren't being returned in the $prepared array, so I wrote a plugin that I thought others might find helpful.
The Hook Location is "member_build_blocks_start" and the Plugin PHP Code is:
if (!$prepared['profilepicurl'])
{
global $vbulletin;
$ppuserinfo = fetch_userinfo($prepared['userid'],8);
if ($vbulletin->options['usefileavatar'])
{
$ppuserinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' . $ppuserinfo['userid'] . '_' . $ppuserinfo['profilepicrevision'] . '.gif';
if (!file_exists($ppuserinfo['profilepicurl']))
{
$ppuserinfo['profilepicrevision'] = 0;
}
}
else
{
$ppuserinfo['profilepicurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $ppuserinfo['userid'] . "&dateline=$ppuserinfo[profilepicdateline]&type=profile";
}
if ($ppuserinfo['profilepicrevision'] OR $ppuserinfo['profilepicdateline'])
{
$prepared['profilepicurl'] = $ppuserinfo['profilepicurl'];
}
}