View Issue Details

IDProjectCategoryView StatusLast Update
0004820mantisbtfeaturepublic2012-03-22 04:55
ReporterMindRiot Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Summary0004820: Would be nice to view who is currently logged in
Description

I cant seem to find a way to display currently logged in users.
That would be a very helpful feature.

Additional Information

In addition, some extra user tracking features might be nice, like last login, IPs used, etc

TagsNo tags attached.
Attached Files
show_who_is_connected.patch.txt (2,257 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.237
diff -u -r1.237 config_defaults_inc.php
--- config_defaults_inc.php	23 Dec 2004 14:43:15 -0000	1.237
+++ config_defaults_inc.php	11 Jan 2005 23:04:51 -0000
@@ -1502,4 +1502,8 @@
 	# NOTE: These are meaningless under Windows! Just ignore them!
 	$g_dot_tool							= '/usr/bin/dot';
 	$g_neato_tool						= '/usr/bin/neato';
+	
+	
+	# Shows the list of all connected users in the footer of each pages (guideweb)
+	$g_show_who_is_connected= ON;
 ?>
Index: core/html_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v
retrieving revision 1.145
diff -u -r1.145 html_api.php
--- core/html_api.php	22 Dec 2004 20:25:55 -0000	1.145
+++ core/html_api.php	11 Jan 2005 23:06:37 -0000
@@ -391,6 +391,41 @@
 				}
 				echo "\t", '<tr><td></td><td>', $t_total, '</td><td></td></tr>', "\n";
 				echo "\t",  '</table>', "\n";
+				
+				
+			}
+		}
+		
+		
+		# This allow users or anonymous to see who are connected 
+		# It simply chech who has updated a page in the last 5 minutes (guideweb)
+		if( ON == config_get( 'show_who_is_connected' ) ) {
+		
+			
+			
+			# Generate timestamp 
+			$t_last_5min_timestamp = mktime(date("H"), date("i") -5, date("s"), date("m"), date("d"),  date("Y"));
+			$t_date_last_5min_date = date("Y-m-d H:i:s" , $t_last_5min_timestamp);
+						
+			
+			# Execute query
+			$t_user_table = config_get( 'mantis_user_table' );
+			$query = "SELECT username 
+			  FROM $t_user_table
+			  WHERE last_visit > '$t_date_last_5min_date'";
+			$result = db_query( $query );
+			
+			# Get the list of connected users
+			while ( $row = db_fetch_array( $result ) ) {
+				$t_users_connected[]	= $row['username'];
+			} 
+			
+			# This message is displayed on the login page, so we need to say if no user are currently connected
+			if (count($t_users_connected) == 0 ) {
+				echo 'No user  connected.';
+			}
+			else {
+				echo 'Users connected : ' . implode(', ',$t_users_connected) . '.';
 			}
 		}
 	}

Relationships

related to 0012909 new number of logged users 

Activities

guideweb

guideweb

2005-01-11 18:04

reporter   ~0008953

Last edited: 2005-01-11 18:05

This allow users or anonymous to see who are connected
It simply chech who has updated a page in the last 5 minutes

See .patch.txt for more details

vboctor

vboctor

2005-01-12 19:37

manager   ~0008986

Thanks for contributing such feature. I think it will be a nice addition to Mantis. We just need to think where it should be shown and in what format.

My comment on the concept is that I would rather have a configurable access level threshold that determines who can see the online users (for example, DEVELOPER) rather than just an ON / OFF.

I will review the code and put more comments later.

guideweb

guideweb

2005-02-20 11:01

reporter   ~0009353

Are you going to add thease features ? if you dont i can.

vboctor

vboctor

2005-02-20 17:03

manager   ~0009355

I implemented the following in user_api.php, based on your patch. I still have to add the GUI for it. I think we should also have the config as a threshold which specifies the minimum threshold that is needed to see the config, or NOBODY to disable the feature.

--------------------

Return an array of user ids that are logged in.

A user is considered logged in if the last visit timestamp is within the

specified session duration.

If the session duration is 0, then no users will be returned.

function user_get_logged_in_user_ids( $p_session_duration_in_minutes ) {
$t_session_duration_in_minutes = (integer)$p_session_duration_in_minutes;

# if session duration is 0, then there is no logged in users.
if ( $t_session_duration_in_minutes == 0 ) {
    return array();
}

# Generate timestamp
# @@@ The following code may not be portable accross DBMS.
$t_last_timestamp_threshold = mktime( date( "H" ), date( "i" ) -1 * $t_session_duration_in_minutes, date("s"), date("m"), date("d"),  date("Y") );
$c_last_timestamp_threshold = date( "Y-m-d H:i:s" , $t_last_timestamp_threshold );

$t_user_table = config_get( 'mantis_user_table' );

# Execute query
$query = "SELECT id FROM $t_user_table WHERE last_visit > '$c_last_timestamp_threshold'";
$result = db_query( $query, 1 );

# Get the list of connected users
$t_users_connected = array();
while ( $row = db_fetch_array( $result ) ) {
    $t_users_connected[] = $row['id'];
}

return $t_users_connected;

}

giallu

giallu

2007-12-10 13:37

reporter   ~0016430

I noticed once that code and wondered where/when it was supposed to be included in the GUI...

any plans for it?

stefang

stefang

2008-02-22 22:00

reporter   ~0017164

Last edited: 2008-02-22 22:00

Hi guys,

I'm also interested in this feature?
Any plans when this will be included in the GUI?

Thanks,
Stefan

giallu

giallu

2008-02-23 04:36

reporter   ~0017166

@stefang. AFAICT, right now it's more a matter of "where" we put that info in the current pages.

any idea?

pluntke

pluntke

2008-02-23 07:39

reporter   ~0017169

I think a good place would be below the menu.
If activated you can see recently viewed issues on the right side but I think
left side is empty.
So you would see youself above the menu and all the others just below it.

(just an idea)

stefang

stefang

2008-02-23 07:43

reporter   ~0017170

Hmmmm, should just be visible for Administrator though, shouldn't it?
So I would suggest to put it under the "Manage" menu.

pluntke

pluntke

2008-02-23 08:07

reporter   ~0017171

Imho that seems to be no big difference to the last visit column you already have on the manage page, (which I'd like to have visible for project managers too (not only admins)).

For the "logged in" users I'd vote to have it "more visible" (instead of a submenu).

giallu

giallu

2008-02-23 13:16

reporter   ~0017172

Last edited: 2008-02-23 15:04

@ stefang.

I'm sure visibility will be controlled by YACP (Yet Another Configuration Parameter)

Of course, I am open for suggestions about the default value

vboctor

vboctor

2008-02-25 00:32

manager   ~0017184

I think we should get some ideas from the forums (see http://www.mantisbt.org/forums) powered by phpBB3. It shows on the index page a list of all active users anonymous and registered. Then on the forum threads it shows an online icon next to users who are online.

Following is a sample of the users only section on the index page:

Who is online

In total there are 6 users online :: 3 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 219 on Sun Jul 01, 2007 7:51 pm

Registered users: Google [Bot], vboctor, Yahoo [Bot]
Legend: Administrators, Global moderators

vboctor

vboctor

2008-02-25 00:34

manager   ~0017185

Last edited: 2008-02-25 00:34

Now that we support plugins, I believe this functionality should be implemented as a plugin, rather than be part of the core. What do you think?

Zamolxis

Zamolxis

2010-01-05 09:38

reporter   ~0024047

It's fine as a plug-in. Is there a list with all the available plug-ins? I expected a link in the Download page or somewhere, but I couldn't find one (sorry if it's a stupid question, I'm new to Mantis, and to bugtrackers in general).

yw84ever

yw84ever

2010-09-20 06:53

reporter   ~0026801

@Zamolxis: http://www.mantisforge.org/dev/manual/master/en/developers.html#DEV.PLUGINS and the source

baamster

baamster

2011-04-18 05:06

reporter   ~0028642

Is this a plugin already? Would very much like to use it ! :)