SimplePortal

Development => Feature Requests => Topic started by: dan4ever on June 28, 2014, 08:12:17 AM

Title: Default avatar...
Post 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
Title: Re: Default avatar...
Post by: ccbtimewiz on June 29, 2014, 05:15:25 PM
You are wanting it to display in Simple Portal's "User Info" block, I assume? Looking at PortalBlocks.php, I find this:

Code: [Select]
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:
Code: [Select]
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;
Replace with:
Code: [Select]
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings, $smcFunc;
Find:
Code: [Select]
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:
Code: [Select]
$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
Title: Re: Default avatar...
Post by: dan4ever on July 01, 2014, 07:18:33 AM
Thanx for taking your time for me.

But it does't show any different at all...

/Dan
Title: Re: Default avatar...
Post by: Esevroff on July 10, 2014, 01:48:59 AM
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)
Title: Re: Default avatar...
Post by: dan4ever on July 10, 2014, 07:15:12 AM
Yes, Drawcia sad that too...
But what should I do?
Title: Re: Default avatar...
Post by: dan4ever on August 02, 2014, 05:42:48 PM
Any more idé about this?
Title: Re: Default avatar...
Post by: Chen Zhen on August 03, 2014, 11:24:13 PM

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.
 
SimplePortal 2.3.8 © 2008-2024, SimplePortal