I need php code of this block, can someone give it to me? :)
You should have the code within your Sources/PortalBlocks.template.php file. Search for the 'sp_userInfor' function.It should be the first function in that file.
Thanks, I have a code now. Can you tell me how to choose which member will be displayed. For example I want to display members
http://mysite.net/index.php?action=profile;u=1
and
http://mysite.net/index.php?action=profile;u=127
???
Well, that will require some diffferent code. That block is only intended to show the user information about themselves.
Try the code below in a custom php block.
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile;
$users = array(1, 127);
foreach ($users as $user_id)
{
loadMemberData($user_id);
loadMemberContext($user_id);
$member_info = $memberContext[$user_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 '
<strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';
if (!empty($member_info['avatar']['image']))
echo '
', $member_info['avatar']['image'], '<br /><br />';
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';
echo '
', $member_info['group_stars'], '<br />';
echo '
<br />
<ul class="sp_list">';
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt[21], ':</strong> ', $member_info['posts'], '</li>';
if (!empty($modSettings['karmaMode']))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $modSettings['karmaLabel'], '</strong> ';
if ($modSettings['karmaMode'] == 1)
echo $member_info['karma']['total'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $member_info['karma']['good'], '/-', $member_info['karma']['bad'];
echo '</li>';
}
if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}
echo '
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
echo '
</ul>
<br />';
echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt[79], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt[108], '</a><br /><br />';
}
Nathaniel, that's a bit dirty to do (calling both loadMemberData and loadMemberContext) in a loop. You're just calling data not needed over and over again.
You could just lap up all the IDs you will load before. Eg...
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile;
$users = array(1, 127);
loadMemberData($users);
foreach ($users as $user_id)
{
loadMemberContext($user_id);
$member_info = $memberContext[$user_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 '
<strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';
if (!empty($member_info['avatar']['image']))
echo '
', $member_info['avatar']['image'], '<br /><br />';
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';
echo '
', $member_info['group_stars'], '<br />';
echo '
<br />
<ul class="sp_list">';
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt[21], ':</strong> ', $member_info['posts'], '</li>';
if (!empty($modSettings['karmaMode']))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $modSettings['karmaLabel'], '</strong> ';
if ($modSettings['karmaMode'] == 1)
echo $member_info['karma']['total'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $member_info['karma']['good'], '/-', $member_info['karma']['bad'];
echo '</li>';
}
if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}
echo '
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
echo '
</ul>
<br />';
echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt[79], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt[108], '</a><br /><br />';
}
Quote from: ccbtimewiz on February 07, 2010, 07:53:32 PM
Nathaniel, that's a bit dirty to do (calling both loadMemberData and loadMemberContext) in a loop. You're just calling data not needed over and over again.
You could just lap up all the IDs you will load before. Eg...
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile;
$users = array(1, 127);
loadMemberData($users);
foreach ($users as $user_id)
{
loadMemberContext($user_id);
$member_info = $memberContext[$user_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 '
<strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';
if (!empty($member_info['avatar']['image']))
echo '
', $member_info['avatar']['image'], '<br /><br />';
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';
echo '
', $member_info['group_stars'], '<br />';
echo '
<br />
<ul class="sp_list">';
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt[21], ':</strong> ', $member_info['posts'], '</li>';
if (!empty($modSettings['karmaMode']))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $modSettings['karmaLabel'], '</strong> ';
if ($modSettings['karmaMode'] == 1)
echo $member_info['karma']['total'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $member_info['karma']['good'], '/-', $member_info['karma']['bad'];
echo '</li>';
}
if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}
echo '
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
echo '
</ul>
<br />';
echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt[79], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt[108], '</a><br /><br />';
}
Yes, that's it... One more thing, now is displaying stats: Username, avatar, membergroup star, posts, karma, total messages, new messages, Recent Unread Topics, Updated Topics profile and log out link. Can it be changed like on this picture:
(https://simpleportal.net/proxy.php?request=http%3A%2F%2Fultraphoto.org%2Fimages%2Ftlyyxcxqn5amz01e5i.jpg&hash=6c8702c7384a0775816fd74c100bc3b20b5dd101)
And the members are one under other, and i need one along other. How to do that? To be more specific, I need just like this picture.
(https://simpleportal.net/proxy.php?request=http%3A%2F%2Fultraphoto.org%2Fimages%2Fxxu66ybskbkodjynapm.jpg&hash=24b27084ae9564afe6ad89ad020a5a4641e52b45)