Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.128 diff -F^f -u -r1.128 updates.inc --- database/updates.inc 16 Aug 2005 20:17:54 -0000 1.128 +++ database/updates.inc 22 Aug 2005 12:21:50 -0000 @@ -43,7 +43,8 @@ "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.254 diff -F^f -u -r1.254 theme.inc --- includes/theme.inc 18 Aug 2005 22:07:14 -0000 1.254 +++ includes/theme.inc 22 Aug 2005 12:21:59 -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) ? t('online') : t('offline'); + $attributes['class'] = "username $status"; + } + $output = l($name, 'user/'. $object->uid, $attributes); } else { $output = $name; Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.519 diff -F^f -u -r1.519 node.module --- modules/node.module 11 Aug 2005 12:53:39 -0000 1.519 +++ modules/node.module 22 Aug 2005 12:22:15 -0000 @@ -354,7 +354,7 @@ function node_load($param = array(), $re } // Retrieve the node. - $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.*, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE '. $cond))); + $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.*, u.uid, u.name, u.picture, u.data, u.access FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE '. $cond))); $node = drupal_unpack($node); // Unserialize the revisions and user data fields. @@ -889,7 +889,7 @@ function node_admin_nodes() { $join .= $filters[$key]['join']; } $where = count($where) ? 'WHERE '. implode(' AND ', $where) : ''; - $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $join .' INNER JOIN {users} u ON n.uid = u.uid '. $where .' ORDER BY n.changed DESC', 50, 0, NULL, $args); + $result = pager_query('SELECT n.*, u.name, u.uid, u.access FROM {node} n '. $join .' INNER JOIN {users} u ON n.uid = u.uid '. $where .' ORDER BY n.changed DESC', 50, 0, NULL, $args); // Make sure the update controls are disabled if we don't have any rows to select from. $disabled = !db_num_rows($result); Index: modules/tracker.module =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker.module,v retrieving revision 1.119 diff -F^f -u -r1.119 tracker.module --- modules/tracker.module 1 Aug 2005 05:14:05 -0000 1.119 +++ modules/tracker.module 22 Aug 2005 12:22:20 -0000 @@ -73,14 +73,14 @@ function tracker_page($uid = 0) { $output .= ''; if ($uid) { - $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_post DESC'; + $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, u.access, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_post DESC'; $sql = db_rewrite_sql($sql); $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)'; $sql_count = db_rewrite_sql($sql_count); $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $uid, $uid); } else { - $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_post DESC'; + $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, u.access, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_post DESC'; $sql = db_rewrite_sql($sql); $sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1'; $sql_count = db_rewrite_sql($sql_count); Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.501 diff -F^f -u -r1.501 user.module --- modules/user.module 11 Aug 2005 13:52:44 -0000 1.501 +++ modules/user.module 22 Aug 2005 12:22:23 -0000 @@ -498,14 +498,10 @@ function user_block($op = 'list', $delta return $blocks; } else if ($op == 'configure' && $delta == 3) { - $period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval'); - $output = form_select(t('User activity'), 'user_block_seconds_online', variable_get('user_block_seconds_online', 900), $period, t('A user is considered online for this long after they have last viewed a page.')); $output .= form_select(t('User list length'), 'user_block_max_list_count', variable_get('user_block_max_list_count', 10), drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), t('Maximum number of currently online users to display.')); - return $output; } else if ($op == 'save' && $delta == 3) { - variable_set('user_block_seconds_online', $edit['user_block_seconds_online']); variable_set('user_block_max_list_count', $edit['user_block_max_list_count']); } else if ($op == 'view') { @@ -551,7 +547,7 @@ function user_block($op = 'list', $delta case 2: if (user_access('access content')) { - $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 ORDER BY created DESC', 0, 5); + $result = db_query_range('SELECT uid, name, access FROM {users} WHERE status != 0 ORDER BY created DESC', 0, 5); while ($account = db_fetch_object($result)) { $items[] = $account; } @@ -565,7 +561,7 @@ function user_block($op = 'list', $delta case 3: if (user_access('access content')) { // Count users with activity in the past defined period. - $time_period = variable_get('user_block_seconds_online', 2700); + $time_period = variable_get('user_seconds_online', 900); // Perform database queries to gather online user lists. $guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period)); @@ -1373,8 +1369,10 @@ function user_configure_settings() { $group .= form_textfield(t('Picture maximum dimensions'), 'user_picture_dimensions', variable_get('user_picture_dimensions', '85x85'), 15, 10, t('Maximum dimensions for pictures.')); $group .= form_textfield(t('Picture maximum file size'), 'user_picture_file_size', variable_get('user_picture_file_size', '30'), 15, 10, t('Maximum file size for pictures, in kB.')); $group .= form_textarea(t('Picture guidelines'), 'user_picture_guidelines', variable_get('user_picture_guidelines', ''), 60, 5, t('This text is displayed at the picture upload form in addition to the default guidelines. It\'s useful for helping or instructing your users.')); - $output .= form_group(t('Pictures'), $group); + + $period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval'); + $output .= form_select(t('User activity'), 'user_seconds_online', variable_get('user_seconds_online', 900), $period, t('A user is considered online for this long after they have last viewed a page.')); return $output; }