Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 938
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Showing Crowns on SimplePortal (On Block: Who's Online)

Started by Xynasty, October 24, 2010, 04:36:29 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Xynasty

Hello.

I have no idea how to do this. :(
I really need help on how to put the crowns on my "Who's Online" block on SimplePortal (on my forum portal).

So, I installed this Mod: http://custom.simplemachines.org/mods/index.php?mod=1801

And after, I put crowns for each groups.
The crowns are showing everywhere but not on SimplePortal block: Who's Online.
So, I would like someone to help me / teach me how to make it work with SimplePortal so my crowns can show there. I've seen this working on other forums but I just don't know how. Maybe I need another mod to do it.

Here's the picture of my "Who's Online" block:



So yeah, I need the crowns to show besides the usernames. They show perfectly on the forum.

If you can help me via MSN, my MSN is Ineedhelpfrugooscape@Hotmail.com


Thank you.

AngelinaBelle

It sounds like you want a "Crowns for SimplePortal" mod as a companion the the Crowns mod.

Crown's install instructions are shown at:
http://custom.simplemachines.org/mods/index.php?action=parse;mod=1801;attach=104894;smf_version=2.0_RC3

This tells you the changes the package makes to your SMF files.

You can see the changes in the files index.template.php, Memberlist.template.php, and Who.template.php

You will need to make similar changes to function sp_whosOnline.


Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Xynasty

Quote from: AngelinaBelle on October 25, 2010, 09:18:30 AM
It sounds like you want a "Crowns for SimplePortal" mod as a companion the the Crowns mod.

Crown's install instructions are shown at:
http://custom.simplemachines.org/mods/index.php?action=parse;mod=1801;attach=104894;smf_version=2.0_RC3

This tells you the changes the package makes to your SMF files.

You can see the changes in the files index.template.php, Memberlist.template.php, and Who.template.php

You will need to make similar changes to function sp_whosOnline.

Thanks !
But the changes in the 3 files you told me will need to be changed like the "sp_whosOnline" ? Sorry but I don't really know how to get this to work and I really want it. It would be nice if there would be a Crowns for SimplePortal mod like you said. :P

I have looked through the sp_whosOnline method and I have no idea how to make changes.

Thanks for the help !

AngelinaBelle

To show crowns, function sp_whosOnline needs to be changed.

You can see how crowns are shown in the forum's "Who's Online" page (/index.php?action=who) by looking into those other files.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Xynasty

Quote from: AngelinaBelle on October 26, 2010, 08:41:09 AM
To show crowns, function sp_whosOnline needs to be changed.

You can see how crowns are shown in the forum's "Who's Online" page (/index.php?action=who) by looking into those other files.

Okay thanks.
Is this the first time someone ask for Crowns help ?

AngelinaBelle

I did a search on crowns -- yours is the only crowns question I found.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Xynasty

Okay here's my 'sp_whosOnline' function:

function sp_whosOnline($parameters, $id, $return_parameters = false)
{
global $db_prefix, $user_info, $context, $scripturl, $modSettings, $txt;

$block_parameters = array(
'online_today' => 'check'
);

if ($return_parameters)
return $block_parameters;

$online_today = !empty($parameters['online_today']);

$stats = ssi_whosOnline('array');

echo '
<ul class="sp_list">
<li>', sp_embed_image('dot'), ' ', $txt['guests'], ': ', $stats['guests'], '</li>
<li>', sp_embed_image('dot'), ' ', $txt['hidden'], ': ', $stats['hidden'], '</li>
<li>', sp_embed_image('dot'), ' ', $txt['users'], ': ', $stats['num_users'], '</li>';

if (!empty($stats['users']))
{
echo '
<li>', sp_embed_image('dot'), ' ', allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' . $scripturl . '?action=who">' : '', $txt[158], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' : '', ':</li>
</ul>
<div class="sp_online_flow">
<ul class="sp_list">';

foreach ($stats['users'] as $user)
echo '
<li class="sp_list_indent">', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'], '</li>';

echo '
</ul>
</div>';
}
else
{
echo '
</ul>
<br />
<div class="sp_fullwidth sp_center">', $txt['error_sp_no_online'], '</div>';
}

if ($online_today && !empty($txt['uot_users_online_today']))
{
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);

$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
$time_fmt = '%I:%M' . $s . ' %p';
else
$time_fmt = '%H:%M' . $s;

$result = db_query("
SELECT
mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);

$stats['num_hidden_users_online_today'] = 0;
$stats['users_online_today'] = array();
$stats['list_users_online_today'] = array();

while ($row = mysql_fetch_assoc($result))
{
if (empty($row['showOnline']))
{
$stats['num_hidden_users_online_today'] = $stats['num_hidden_users_online_today'] + 1;
if (!$user_info['is_admin'])
continue;
}

$userday = strftime('%d', forum_time(true));
$loginday = strftime('%d', forum_time(true, $row['lastLogin']));
$yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];

$lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
$title = ' title="' . $lastLogin . '"';

if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';

$is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
if ($is_buddy)
$link = '<b>' . $link . '</b>';

$stats['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'is_buddy' => $is_buddy,
'hidden' => empty($row['showOnline']),
);

$stats['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = empty($row['showOnline']) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);

krsort($stats['users_online_today']);
krsort($stats['list_users_online_today']);

$stats['num_users_online_today'] = count($stats['users_online_today']);
if (!$user_info['is_admin'])
$stats['num_users_online_today'] = $stats['num_users_online_today'] + $stats['num_hidden_users_online_today'];

if (empty($stats['num_users_online_today']))
return;

echo '
<ul class="sp_list">
<li>', sp_embed_image('dot'), ' ', $txt['sp-online_today'], ': ', $stats['num_users_online_today'], '</li>
</ul>
<div class="sp_online_flow">
<ul class="sp_list">';

foreach ($stats['users_online_today'] as $user)
echo '
<li class="sp_list_indent">', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'], '</li>';

echo '
</ul>
</div>';
}
}


What should I change or add ? I'm not really good and I tried things. I was only getting errors. I don't wanna f**k up my forum.  :|

I found something similar and something that should be able when we install the "Crowns" mod:

' . (!empty($member['group_item']['crown']) && empty($modSettings['hide_who_is_online']) ? $member['group_item']['crown'] : '') . $member['name'] . '</a>', '</span>';

This is in Who.template.php.

Can you help me please ?

Thanks !

Edit-> Removed obscene language

AngelinaBelle

Trying is a good way to learn. And you can do it without messing up your forum.
Reading is good, too. w3schools.com has a nice totorial, and php.net has the php manual.

Here are some ideas to avoid messing up your forum while you try things out.
1) Install a second forum.  It can be at /testforum/index.php, for example
2) Do some of your testing in a custom php block that only shows up on a custom page, so you can quickly figure things out without messing up other pages.
3) You can create copies of functions you want to work on, then rename the copies, so you can easily compare the original to the "in progress" one, since they are both still available.

---
1) You need to make sure the CROWN information is collected from the database
2) You need to write out that CROWN information the way you want to see it.

* you identified the stuff you want in Who.template.php.  Who.template.php is where the information gathered up in Who.php gets printed out. Who.php gets its CROWN information via a function in Load.php.
* sp_whosOnline basically prints out information by ssi_whosOnline

The crown mod adds stuff to Load.php, but leaves SSI.php alone.
If you want a SimplePortal block to call ssi_whosOnline, you'll have to modify ssi_whosOnline to gather the information you want.  You can see what that is by looking at what the mod does to Load.php.


Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?