Default Avatar

Started by vbgamer45, July 30, 2010, 11:25:41 PM

Previous topic - Next topic

Wally.

Hey Joker I've been using this mod for a while (thanks by the way) and I just updated my system and this mod. However, it doesn't display the avatars in my portal blocks. I was under the impression that the new version worked with simple portal was I incorrect or do I have some sort of install issue?

live627

Did you download    Default Avatar 2.0 (Source) For SMF 2x.zip

Wally.

Yep thats the one I installed.

live627

I'd assume you enabled the mod...

If so, then SP didn't call from the centralised member functions since that is only what this mod modifies. Check with the folks on SP.net since I could be wrong on it. I haven't looked at their code.

Wally.

Here is the response that I got from the SP staff:

QuoteHave a look at function sp_userInfo in PortalBlocks.php

You can see that, to get a registered users's member info, it does

  loadMemberData($user_info['id']);
  loadMemberContext($user_info['id']);
  $member_info = $memberContext[$user_info['id']];

and then it uses

  if (!empty($member_info['avatar']['image']))
   echo '
         ', $member_info['avatar']['image'], '<br /><br />';

to display the image.

If the mod does not stuff the default avatar image into $memberContext[$user_info['id']['avatar']['image'], then you can copy a little of the mod's logic in this spot --- else echo $default_avatar_link; sort of thing.

So at this point am I correct in assuming that this means there was an issue with the install somewhere?

Joker™

Isn't my load.php code loading ($memberContext[$user]['avatar']['image']) ?

Please have a look at the code which this mod is modifying in Load.php.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Wally.

I checked it and this is what was there:

if ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && !empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => '',
'url' => '',
);

elseif ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'href' => '',
'url' => '',
);
// Are we also loading the members custom fields into context?

Joker™

so isn't this much code is sufficient from my part

$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => '',
'url' => '',
);
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Wally.

Quote from: Joker™ on January 01, 2011, 11:47:51 PM
so isn't this much code is sufficient from my part

I'm sorry Joker I'm not sure what you meant here.

Joker™

Yeyy some vacations for me at last, if i get a chance I'll install SP by today only and will try to look into the problem.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Joker™

Quote from: Wally. on January 02, 2011, 11:12:14 PM
Quote from: Joker™ on January 01, 2011, 11:47:51 PM
so isn't this much code is sufficient from my part

I'm sorry Joker I'm not sure what you meant here.
The code I showed you above your post,

$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => '',
'url' => '',
);


sums up like,

$memberContext[$user]['avatar']['name']
$memberContext[$user]['avatar']['image'] , and so on.

which I think is required for SP.

I installed simple portal, since I'm a real noob in using this portals, can you tell me which(and how) sort of portal block you have created in which this mod(default avatar) hasn't worked properly.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Wally.

#51
Sure, I'm using the Top Poster Block (set to display the top 10 posters for the month) and the Board News Block. Top Poster is on the top left side of this page http://www.wallynet.org/forum/index.php and Board News is below the gallery pics.

You'll be able to see the blank slots in the top left block - those are people with default avatars.

In the Board News area the avatar on the right would be empty if the thread was started by someone with a default avatar.

And all of that was set up through "Administration Center > Simple Portal > Blocks > Block List".

(I've attached a screen cap below showing the blanks next to Donuticus, Ari and Mister iLose)


Joker™

OMG, i don't know how I forgot to reply to you :o.

Try these codes (after installing the Default avatar mod, make these changes).

In Load.php
Find:

if ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && !empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => '',
'url' => '',
);

elseif ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'href' => '',
'url' => '',
);



Replace it with:

if ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && !empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => $modSettings['default_avatar_url'],
'url' => '',
);

elseif ($memberContext[$user]['avatar']['image'] == '' && !empty($modSettings['enable_default_avatar']) && empty($modSettings['default_avatar_url']))
$memberContext[$user]['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'href' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'url' => '',
);



In Subs.php
Find:

if (empty($context['user']['avatar']['image']) && !empty($modSettings['enable_default_avatar']) && !empty($modSettings['default_avatar_url']))
$context['user']['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => $modSettings['default_avatar_url'],
'url' => '',
);

if (empty($context['user']['avatar']['image']) && !empty($modSettings['enable_default_avatar']) && empty($modSettings['default_avatar_url']))
$context['user']['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'href' => '',
'url' => '',
);


Replace it with:

if (empty($context['user']['avatar']['image']) && !empty($modSettings['enable_default_avatar']) && !empty($modSettings['default_avatar_url']))
$context['user']['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => $modSettings['default_avatar_url'],
'url' => '',
);

if (empty($context['user']['avatar']['image']) && !empty($modSettings['enable_default_avatar']) && empty($modSettings['default_avatar_url']))
$context['user']['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'href' => '<img class="avatar" src="' . $settings['images_url'] . '/default_avatar.png" />',
'url' => '',
);

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Wally.

Quote from: Joker™ on January 14, 2011, 09:52:01 AM
OMG, i don't know how I forgot to reply to you :o.

No worries.  :)

I made the change to both the sub and load files but it didn't seem to make a difference. Just to make sure I didn't do anything wrong the 'href' lines were the only things that changed weren't they?

Joker™

Quote from: Wally. on January 14, 2011, 08:46:53 PM
I made the change to both the sub and load files but it didn't seem to make a difference. Just to make sure I didn't do anything wrong the 'href' lines were the only things that changed weren't they?
Yeah, as SP is calling for avatars using ['avatar']['href'].

I'll look into this again.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Joker™

I even tried with this, but it result was negative.

In Sources\PortalBlock.php
Find:
if (empty($members))
{
echo '
', $txt['error_sp_no_members_found'];
return;


Before:
if (empty($members['avatar']['image']) && !empty($modSettings['enable_default_avatar']))
{ $members['avatar'] = array(
'name' => '',
'image' => '<img class="avatar" src="' . $modSettings['default_avatar_url'] . '" />',
'href' => $modSettings['default_avatar_url'],
'url' => '',
);
}
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Wally.

Regardless, thanks for giving it a go.

:)

Yankee

#57
Well, here's a question for ya Joker:

In the manual install instructions for SMF 1.1.13 to this mod you refer to a file called ./Sources/ManageSettings.php that needs to be edited, but there is no file by that name. At least I can't find it.

Is this a typo or have my brain just turned into slush?

live627


Yankee

Quote from: live627 on April 27, 2011, 12:14:29 AM
SMF 2.x only

Well, then someone seriously needs to edit the damn instructions.

Thanx anyway  ;)

Advertisement: