More online users list
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #1
More online users list
Here is the code that is displaying only 14 online users per line and starting the next list new line, leaving extra spaces as in pic.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php

/*////////////////////////////////////////////////////////////////////
 * Displays Who's Online Today On Board Statistics On The Forum Index
 * Displays who was online today on the forum index.
 *////////////////////////////////////////////////////////////////////

$plugins->add_hook('index_start', 'who_online');

function who_online_info()
{
	return array(
		'name'			=> 'Who Was Online Today ?',
		'description'	=> 'Displays who was online today on forum index (Board Stats',
		'website'		=> 'http://mybbextras.com',
		'author'		=> 'Janota',
		'authorsite'	=> 'http://mybbextras.com',
		'version'		=> '1.0',
		"compatibility" => "16*"

	);
}


function who_online_activate()
{
	global $db;


}

function who_online()
{
	global $db,$ontoday,$lang,$theme, $mybb, $templates;
	$lang->load("online");
$todaycount = 0;
	$stime = TIME_NOW-(60*60*24);
	$todayrows = '';
	$query = $db->query("
		SELECT u.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
		WHERE u.lastactive > $stime
		ORDER BY u.lastactive DESC
	");
	$total=$db->num_rows($query);
	$i=1;
	$x=0;
	while($online = $db->fetch_array($query))
	{
		if($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $online['uid'] == $mybb->user['uid'])
		{
			if($online['invisible'] == 1)
			{
				$invisiblemark = "*";
			}
			else
			{
				$invisiblemark = "";
			}
			$username = $online['username'];
			$username = format_name($username, $online['usergroup'], $online['displaygroup']);
			$online['profilelink'] = build_profile_link($username, $online['uid']);
			$onlinetime = my_date($mybb->settings['timeformat'], $online['lastactive']);
			$onToday.=$online['profilelink'];
		}

		if ($i != $total)
		{
		$onToday.=", ";
		}
		if ($x == 14)
		{
			$onToday.="<br/>";
			$x=0;
}
		$x++;
		$i++;
		++$todaycount;
	}
	if($todaycount == 1)
	{
		$who_online = $lang->member_online_today;
	}
	else
	{
		$who_online = $lang->sprintf($lang->members_were_online_today, $todaycount);
	}

        if(in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6))) 
        {
	$ontoday=<<<HERE
<td class="trow1"><a href="/forum/online.php?action=today" target="_blank"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/></a>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;
        }
        else
        {
        $ontoday=<<<HERE
<td class="trow1"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;
        }

}

function who_online_deactivate()
{

}


?>


How can we make it display the whole available online users without any link breaks?

   


is it possible that it increments the counter for every member that comes to online and display the who users online list without breaking?
(This post was last modified: 10-23-2010 09:42 AM by 1master1.)
10-22-2010 02:13 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #2
RE: More online users list
You want to make a limit of users ? If yes, You have to use query something like this query;

PHP Code:
1
2
3
4
5
6
7
8
	$query = $db->query("
		SELECT u.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
		WHERE u.lastactive > $stime
		ORDER BY u.lastactive DESC
LIMIT ".$mybb->settings['how_many_users']."");
	");


[Image: logo.png]

[Image: twitter.png]
10-23-2010 02:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #3
RE: More online users list
no, i dont want to limit users for now, i just want to display whole users list without breaking lines as in picture after every 14 users
10-23-2010 03:27 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #4
RE: More online users list
For this, search <br /> in the code and remove it. e.g. this one;

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	$ontoday=<<<HERE
<td class="trow1"><a href="/forum/online.php?action=today" target="_blank"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/></a>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;
        }
        else
        {
        $ontoday=<<<HERE
<td class="trow1"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;


[Image: logo.png]

[Image: twitter.png]
10-23-2010 05:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #5
RE: More online users list
this will make the users displayed right after the  "- members online today" text without a line break.
i'm not asking this. if you see yellow circles, they appear because, after 14users display in single or 2 lines, the remaining space doesnt display usernames, and it starts in next line with fresh 14 users list. now i want to display users list uninterruptedly.
i figured out that increasing this value (14) in the code "if ($x == 14)" displays that many numbers without any break. but without setting this value to high, is their anyway that it automatically increases the counter and displays the whole users list?
10-23-2010 09:43 AM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #6
RE: More online users list
i figured out that this code controls the display of online users

Code:
		if ($x == 14)
		{
			$onToday.="<br/>";
			$x=0;
}

Changing the $x== 14 value is displaying that many online users, suppose if it is $x==100, then it is displaying 100 online users continuosly without line breaks. But if there is also some space after 100th member, the 101th member if being displayed in next line leaving a huge gap like in first post attachment image. Now i want that value to be incremented automatically to show the full online users display without any line breaks. If users are 220, it must all 220 or 300 must show all 300 without any line breaks.

10-26-2010 09:27 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #7
RE: More online users list
How about just removing that piece of code? Tongue

My Blog
(This post was last modified: 10-26-2010 10:32 PM by ZiNgA BuRgA.)
10-26-2010 10:31 PM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #8
RE: More online users list
ahh..... being an IT student i failed to check that "if" clause. my bad. thank you very much yumi.
problem fixed
(This post was last modified: 10-26-2010 11:55 PM by 1master1.)
10-26-2010 11:49 PM
Find all posts by this user Quote this message in a reply
Midori Offline
Junior Member
**
Posts: 3
Joined: Apr 2013
Post: #9
RE: More online users list
How can it show title for online members? . for example: in mouse over show "last visit:9:40 AM" Thanks.
{$onlinetime} or {$onlinedate}
(This post was last modified: 06-07-2014 04:04 PM by Midori.)
06-07-2014 04:02 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: