A misc/offline.png A misc/online.png Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.128 diff -u -p -r1.128 updates.inc --- database/updates.inc 16 Aug 2005 20:17:54 -0000 1.128 +++ database/updates.inc 27 Aug 2005 21:03:27 -0000 @@ -43,7 +43,8 @@ $sql_updates = array( "2005-07-29" => "update_142", "2005-07-30" => "update_143", "2005-08-08" => "update_144", - "2005-08-15" => "update_145" + "2005-08-15" => "update_145", + "2005-08-21" => "update_146", ); function update_110() { @@ -705,6 +706,11 @@ function update_145() { return $ret; } +function update_146() { + $ret[] = update_sql("UPDATE {variable} SET name = 'user_seconds_online' WHERE name = 'user_block_seconds_online'"); + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.255 diff -u -p -r1.255 theme.inc --- includes/theme.inc 25 Aug 2005 21:14:16 -0000 1.255 +++ includes/theme.inc 27 Aug 2005 21:03:28 -0000 @@ -1005,7 +1005,7 @@ function theme_confirm($question, $path, * Format a username. * * @param $object - * The user object to format, usually returned from user_load(). + * The user object to format, usually returned from user_load(). Ideally, should contain the uid, name, and access elements. * @return * A string containing an HTML link to the user's page if the passed object * suggests that this is a site user. Otherwise, only the username is returned. @@ -1022,7 +1022,13 @@ function theme_username($object) { } if (user_access('access user profiles')) { - $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.'))); + $attributes['title'] = t('View user profile.'); + if (isset($object->access)) { + $time_period = variable_get('user_seconds_online', 900); + $status = (time()-$time_period < $object->access) ? "online" : "offline"; + $attributes['class'] = "username-{$status}"; + } + $output = l($name, 'user/'. $object->uid, $attributes); } else { $output = $name; Index: misc/drupal.css =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.css,v retrieving revision 1.114 diff -u -p -r1.114 drupal.css --- misc/drupal.css 22 Aug 2005 20:29:00 -0000 1.114 +++ misc/drupal.css 27 Aug 2005 21:03:29 -0000 @@ -493,6 +493,18 @@ tr.watchdog-error .active { #comment-moderation-button { text-align: center; } +.username-online { + background-image: url(online.png); + background-repeat: no-repeat; + background-position: right center; + padding-right: 13px; +} +.username-offline { + background-image: url(offline.png); + background-repeat: no-repeat; + background-position: right center; + padding-right: 13px; +} /* Tab navigation */ ul.primary { Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.366 diff -u -p -r1.366 comment.module --- modules/comment.module 25 Aug 2005 21:14:16 -0000 1.366 +++ modules/comment.module 27 Aug 2005 21:03:32 -0000 @@ -793,7 +793,7 @@ function comment_render($node, $cid = 0) $output .= '