Jump to content

"Who's online" discrepancy


broni

Recommended Posts

You can alter the template for it, fairly simple.

Go to your ACP->Customizations->Themes, find your them click on the </> icon.

Make sure the templates tab is highlight, and go to core->front->widgets, and open 'whosOnline', and replace the contents with this:

<h3 class='ipsType_reset ipsWidget_title'>
	{lang="block_whosOnline"}
		&nbsp;&nbsp;<span class='ipsType_light ipsType_unbold ipsType_medium'>{lang="block_whos_online_info_members" pluralize="$memberCount"}, {lang="block_whos_online_info_anonymous" pluralize="$anonymous"}, {lang="block_whos_online_info_guests" pluralize="$guests"}</span>
	<span class='ipsType_medium ipsType_light ipsType_unbold ipsType_blendLinks'><a href='{url="app=core&module=online&controller=online" seoTemplate="online"}'>{lang="see_full_list"}</a></span>
</h3>
<div class='ipsWidget_inner {{if $orientation == 'vertical'}}ipsPad{{endif}}'>
	{{if $memberCount}}
		<ul class='ipsList_inline ipsList_csv ipsList_noSpacing'>
			{{foreach $members as $row}}
				<li>{template="userLinkFromData" group="global" app="core" params="$row['member_id'], $row['member_name'], $row['seo_name'], $row['member_group']"}</li>
			{{endforeach}}
		</ul>
		{{if $orientation == 'vertical' and $memberCount > 60}}
			<p class='ipsType_medium ipsType_reset'>
				<a href='{url="app=core&module=online&controller=online" seoTemplate="online"}'>{lang="and_x_others" pluralize="$memberCount - 60"}</a>
			</p>
		{{endif}}
	{{else}}
		<p class='ipsType_reset ipsType_medium ipsType_light'>{lang="whos_online_users_empty"}</p>
	{{endif}}
</div>

2015-07-15_0236.thumb.png.69088b8b9c6215

it will look something like this, as the styling is bit different on the h3 for the sidebar. This is however not the ideal solution, this should really easy to do with a plugin with a template hook.

Link to comment
Share on other sites

Oh yes, they changed it.

Before:

        if ( $this->orientation === 'horizontal' )
        {
            foreach ( \IPS\Db::i()->select( 'login_type, COUNT(*) AS count', 'core_sessions', array( 'running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ), NULL, NULL, 'login_type' ) as $row )
            {

Now:

		foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type', 'core_sessions', $where, 'core_sessions.running_time DESC', $this->orientation === 'horizontal' ? NULL : 60 )->join( 'core_groups', 'core_sessions.member_group=core_groups.g_id' ) as $row )
		{

It's there since 4.0.9. My post is from march... :)

Link to comment
Share on other sites

Sure, this is the changed code:

<h3 class='ipsType_reset ipsWidget_title'>
	{lang="block_whosOnline"}
</h3>
<div class='ipsWidget_inner {{if $orientation == 'vertical'}}ipsPad{{endif}}'>
   <p class='ipsType_reset ipsType_medium ipsType_light'>
    <span class='ipsType_light ipsType_unbold ipsType_medium'>{lang="block_whos_online_info_members" pluralize="$memberCount"}, {lang="block_whos_online_info_anonymous" pluralize="$anonymous"}, {lang="block_whos_online_info_guests" pluralize="$guests"}</span>
	  <span class='ipsType_medium ipsType_light ipsType_unbold ipsType_blendLinks'><a href='{url="app=core&module=online&controller=online" seoTemplate="online"}'>{lang="see_full_list"}</a></span>
   </p>
	{{if $memberCount}}
		<ul class='ipsList_inline ipsList_csv ipsList_noSpacing'>
			{{foreach $members as $row}}
				<li>{template="userLinkFromData" group="global" app="core" params="$row['member_id'], $row['member_name'], $row['seo_name'], $row['member_group']"}</li>
			{{endforeach}}
		</ul>
		{{if $orientation == 'vertical' and $memberCount > 60}}
			<p class='ipsType_medium ipsType_reset'>
				<a href='{url="app=core&module=online&controller=online" seoTemplate="online"}'>{lang="and_x_others" pluralize="$memberCount - 60"}</a>
			</p>
		{{endif}}
	{{else}}
		<p class='ipsType_reset ipsType_medium ipsType_light'>{lang="whos_online_users_empty"}</p>
	{{endif}}
  </div>

 

Link to comment
Share on other sites

@CodingJungle, you need to edit the widget PHP file. It is hardcoded on horizontal view.

Oh yes, they changed it.

Before:

        if ( $this->orientation === 'horizontal' )
        {
            foreach ( \IPS\Db::i()->select( 'login_type, COUNT(*) AS count', 'core_sessions', array( 'running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ), NULL, NULL, 'login_type' ) as $row )
            {

Now:

		foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type', 'core_sessions', $where, 'core_sessions.running_time DESC', $this->orientation === 'horizontal' ? NULL : 60 )->join( 'core_groups', 'core_sessions.member_group=core_groups.g_id' ) as $row )
		{

It's there since 4.0.9. My post is from march... :)

I'm not sure when they changed it, and it is easier to change the template than it would be the widget code :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...