SimplePortal
Development => Feature Requests => Topic started by: dan4ever on June 28, 2014, 08:12:17 AM
-
Hi
I'm using "Default Avatar Per Membergroup" but Simple Portal dosn't show this.
Do you have a work around och a fix to this?
/Dan
-
You are wanting it to display in Simple Portal's "User Info" block, I assume? Looking at PortalBlocks.php, I find this:
loadMemberData($user_info['id']);
loadMemberContext($user_info['id'], true);
$member_info = $memberContext[$user_info['id']];
if (sp_loadColors($member_info['id']) !== false)
$member_info['colored_name'] = $color_profile[$member_info['id']]['colored_name'];
$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];
echo '
', strtolower($member_info['name']) === 'okarin' ? 'Okae-Rin, ' : $txt['hello_member'], ' <strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';
if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';
It's using loadMemberData() to determine user information, a function found within Load.php.
The mod Default Avatar Per Membergroup seems to not emake any edits to this function, thus why it's not appearing in Simple Portal. However it does seem to be editing loadUserSettings().
So perhaps try something like thi;
Open ./Sources/PortalBlocks.php
Find:
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;
Replace with:
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings, $smcFunc;
Find:
if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';
Replace with:
$request = $smcFunc['db_query']('', '
SELECT def_avatar, force_avatar
FROM {db_prefix}membergroups',
array()
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (!empty($row['force_avatar']))
$member_info['avatar']['image'] = $row['force_avatar'];
else
$member_info['avatar']['image'] = $row['def_avatar'];
}
$smcFunc['db_free_result']($request);
if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';
I have not tested it, but I hope this works or heads you off in the right direction
-
Thanx for taking your time for me.
But it does't show any different at all...
/Dan
-
The mod Default Avatar Per Membergroup seems to not emake any edits to this function, thus why it's not appearing in Simple Portal. However it does seem to be editing loadUserSettings() (http://simpleportal.net/Smileys/SimplePortal/nervous-happy.gif) (http://xn--80aaccmcb3cqmbsjg3s.xn--p1ai)
-
Yes, Drawcia sad that too...
But what should I do?
-
Any more idé about this?
-
dan4ever,
Replace your ../Sources/PortalBlocks.php with the file attached to this post and let me know if it works as requested. If you have the membergroup default avatar forced or if the user does not have an avatar then the default avatar should display for those members. I adjusted it for all prefab SP blocks within that file.
Regards.