Development > Feature Requests

Default avatar...

(1/2) > >>

dan4ever:
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

ccbtimewiz:
You are wanting it to display in Simple Portal's "User Info" block, I assume? Looking at PortalBlocks.php, I find this:


--- Code: --- 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 />';
--- End code ---

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: ---global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;
--- End code ---

Replace with:

--- Code: ---global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings, $smcFunc;
--- End code ---

Find:

--- Code: --- if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';
--- End code ---

Replace with:

--- Code: --- $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 />';

--- End code ---

I have not tested it, but I hope this works or heads you off in the right direction

dan4ever:
Thanx for taking your time for me.

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

/Dan

Esevroff:
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()

dan4ever:
Yes, Drawcia sad that too...
But what should I do?

Navigation

[0] Message Index

[#] Next page

Go to full version