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 login or register.

* Who's Online

  • Dot Guests: 707
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* 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]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: User Info / OnLine / Num of Posts  (Read 6029 times)

0 Members and 1 Guest are viewing this topic.

Offline Shortie

  • Semi Newbie
  • *
  • Posts: 21
  • The Art OF Graphics
    • Graphics Mayhem
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
User Info / OnLine / Num of Posts
« on: February 15, 2009, 06:30:37 PM »
Hi Guys and Gals

Have created this Block for

User Info
Whos on line
Num of Posts

But I would like to add the number of spiders to it as well and also the mini calendar the block code and mini cal code is attached and also a couple of SShots

also I would like to tidy the code up a bit as my PHP skills are very poor and it looks very long winded

If any one has a little time I would most appreciate it

Cheers

Shortie

P.S. Using SMF RC1 and SP 2.1.1
-------------------------------

Block Code

Code: [Select]
{

global $smcFunc, $memberContext, $context, $user_info, $txt, $scripturl, $modSettings, $settings, $sc;




global $color_profile;



if($context['user']['is_logged'])

{

$member_id = $user_info['id'];

loadMemberData($member_id);

loadMemberContext($member_id);



//If you install the Membercolor Link the colors will be autmaticly set.

if(empty($modSettings['MemberColorLinkInstalled']) && sp_loadColors($member_id) !== false)

$memberContext[$member_id]['colored_name'] = $color_profile[$member_id]['colored_name'];



$memberContext[$member_id]['karma']['total'] = $memberContext[$member_id]['karma']['good'] - $memberContext[$member_id]['karma']['bad'];

}

echo '<div align="center">';



if ($context['user']['is_guest'])

{

echo '<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">

<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">

<tr>

<td align="right"><label for="user">', $txt['username'], ':</label></td>

<td><input type="text" id="sp_user" name="user" size="9" value="', !empty($user_info['username']) ? $user_info['username'] : '', '" /></td>

</tr><tr>

<td align="right"><label for="passwrd">', $txt['password'], ':</label></td>

<td><input type="password" name="passwrd" id="sp_passwrd" size="9" /></td>

</tr><tr>

<td>

<select name="cookielength">

<option value="60">', $txt['one_hour'], '</option>

<option value="1440">', $txt['one_day'], '</option>

<option value="10080">', $txt['one_week'], '</option>

<option value="43200">', $txt['one_month'], '</option>

<option value="-1" selected="selected">', $txt['forever'], '</option>

</select>

</td>

<td><input type="submit" value="', $txt['login'], '" /></td>

</tr>

</table>

</form>', sprintf($txt['welcome_guest'], $txt['guest_title']);

}

else

{

echo $txt['hello_member'], ' <b>', (!empty($memberContext[$member_id]['colored_name']) ? $memberContext[$member_id]['colored_name'] : $context['user']['name']), '</b><br /><br />';



if (!empty($context['user']['avatar']))

echo $context['user']['avatar']['image'], '<br /><br />';



if (!empty($memberContext[$member_id]['group']))

echo $memberContext[$member_id]['group'];

else

echo $memberContext[$member_id]['post_group'];



echo '<br />', $memberContext[$member_id]['group_stars'], '<hr /></div>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['posts'], ': ',$memberContext[$member_id]['posts'],'<br />';



if(!empty($modSettings['karmaMode']))

echo '

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-userkarma'], ': ';



if($modSettings['karmaMode'] == '1')

echo $memberContext[$member_id]['karma']['total'],'<br />';

elseif($modSettings['karmaMode'] == '2')

echo '+', $memberContext[$member_id]['karma']['good'],'/-', $memberContext[$member_id]['karma']['bad'], '<br />';



}



if(allowedTo('pm_read'))

echo '

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-usertmessage'], ': <a href="' . $scripturl . '?action=pm">' . $context['user']['messages'], '</a><br />

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-usernmessage'], ': ' . $context['user']['unread_messages'], '<hr />';



if (!$context['user']['is_guest'])

echo '

<div align="center"><img src="' . $settings['images_url'] . '/arrow.gif" alt="', $txt['sp-arrow'], '" /> <a href="'.$scripturl.'?action=profile">', $txt['profile'], '</a>   <img src="' . $settings['images_url'] . '/arrow.gif" alt="', $txt['sp-arrow'], '" /> <a href="', $scripturl, '?action=logout;sesc=', $sc, '">', $txt['logout'], '</a>';

echo '</div><hr />';



$totals = array(

'members' => $modSettings['totalMembers'],

'posts' => $modSettings['totalMessages'],

'topics' => $modSettings['totalTopics']

);



$request = $smcFunc['db_query']('','

SELECT COUNT(*)

FROM {db_prefix}boards'

);

list ($totals['boards']) = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);



$request = $smcFunc['db_query']('','

SELECT COUNT(*)

FROM {db_prefix}categories'

);

list ($totals['categories']) = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);;



echo '

<ul style="padding: 0.2em 0.4em 0.2em 0.4em;">

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['gm_total_members'], ': <a href="', $scripturl . '?action=mlist">', $totals['members'], '</a>

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['gm_total_posts'], ': ', $totals['posts'],'

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['gm_total_topics'], ': ', $totals['topics'],'

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['gm_total_cats'], ': ', $totals['categories'],'

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['gm_total_boards'], ': ', $totals['boards'],'

<hr /></li>

</ul>';


$request = $smcFunc['db_query']('','

SELECT

lo.id_member, lo.log_time, mem.real_name, mem.member_name, mem.show_online,

mg.online_color, mg.id_group

FROM {db_prefix}log_online AS lo

LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lo.id_member)

LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = IF(mem.id_group = 0, mem.id_post_group, mem.id_group))'

);



$online['users'] = array();

$online['guests'] = 0;

$online['hidden'] = 0;

$online['buddies'] = 0;

$show_buddies = !empty($user_info['buddies']);



while ($row = $smcFunc['db_fetch_assoc']($request))

{

if (!isset($row['real_name']))

$online['guests']++;

elseif (!empty($row['show_online']) || allowedTo('moderate_forum'))

{

if (!empty($row['online_color']))

$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';

else

$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';



if ($show_buddies && in_array($row['id_member'], $user_info['buddies']))

{

$online['buddies']++;

$link = '<b>' . $link . '</b>';

}



$online['users'][$row['log_time'] . $row['member_name']] = array(

'id' => $row['id_member'],

'username' => $row['member_name'],

'name' => $row['real_name'],

'group' => $row['id_group'],

'href' => $scripturl . '?action=profile;u=' . $row['id_member'],

'link' => $link,

'hidden' => empty($row['show_online']),

'is_last' => false,

);

}

else

$online['hidden']++;

}

$smcFunc['db_free_result']($request);



if (!empty($online['users']))

{

krsort($online['users']);

$userlist = array_keys($online['users']);

$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;

}

$online['num_users'] = count($online['users']) + $online['hidden'];

$online['total_users'] = $online['num_users'] + $online['guests'];



echo '

<ul style="padding: 0.2em 0.4em 0.2em 0.4em;">

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-onlineguest'], ': ', $online['guests'],'

</li>


<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-onlineuser'], ': ', $online['num_users'],'

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-onlinehuser'], ': ', $online['hidden'],'

</li>

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-onlinetuser'], ': ', $online['total_users'],'

</li>';



if(!empty($online['users'])) {



echo '

<li>

<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['sp-onlineouser'], ':

</li>';



foreach ($online['users'] as $user)

echo '

<li style="padding-left: 20px;">

<img src="' . $settings['images_url'] . '/useron.gif" alt="', $txt['user'], '" /> ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'],'

</li>';

}



echo '

</ul>';

}


Mini Cal Code Topic Here

http://simpleportal.net/index.php?topic=89.0


Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: User Info / OnLine / Num of Posts
« Reply #1 on: March 22, 2009, 01:05:19 PM »
Thanks.
my modsI don't reply support PMs. Please use support forums.

Offline larry007

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 1.1.8
  • SP Version: 2.2.1
Re: User Info / OnLine / Num of Posts
« Reply #2 on: May 18, 2009, 04:23:04 PM »
Hi shortie

can we get this for smf 1.1.8 too?

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: User Info / OnLine / Num of Posts
« Reply #3 on: May 19, 2009, 12:46:08 AM »
Hmm possible this work in the same way, us a php block and insert:

Work only with Simple Portal 2.2+
Code: [Select]
sp_userInfo(array(), $id);
echo '<hr />';
sp_boardStats(array(
'averages' => 0
), $id);
echo '<hr />';
sp_whosOnline(array(), $id);

This should be normal output near the same i think ;).
« Last Edit: May 19, 2009, 05:13:20 PM by ディン1031 »
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: User Info / OnLine / Num of Posts
« Reply #4 on: May 19, 2009, 01:29:39 AM »
Hey 1031 (prisoner number?)

I know I'm being cheeky but is there any possibility of some help to install this on our forum?

We are on smf 1.1.8 with sp 2.2.1

Would rather be a   :) man than a  :( man.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: User Info / OnLine / Num of Posts
« Reply #5 on: May 19, 2009, 04:35:18 AM »
Code: [Select]
Hey 1031 (prisoner number?)
Nope my Nickname in japanese :P.

That's easy create an php block and insert this code.
Save the block and see if it work ;).

Bye
DIN1031
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: User Info / OnLine / Num of Posts
« Reply #6 on: May 19, 2009, 02:06:46 PM »
Didn't work.

Parse error: syntax error, unexpected ';', expecting ')' in /home/visionar/public_html/phforum/Sources/SPortal1-1.php(3244) : eval()'d code on line 4

We use 1.1.8 and sp 2.2.1
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: User Info / OnLine / Num of Posts
« Reply #7 on: May 19, 2009, 05:13:37 PM »
Didn't work.

Parse error: syntax error, unexpected ';', expecting ')' in /home/visionar/public_html/phforum/Sources/SPortal1-1.php(3244) : eval()'d code on line 4

We use 1.1.8 and sp 2.2.1
Sorry my mistake <<, made a mistake in the code. (It will normal work with all SP 2.2+ Version and on all SMF Versions ;).

Code: [Select]
sp_userInfo(array(), $id);
echo '<hr />';
sp_boardStats(array('averages' => 0), $id);
echo '<hr />';
sp_whosOnline(array(), $id);
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).