I've been requested to add functionality to a site to list the currently active users. Not 'active' vs. 'blocked' in Drupal 6.2, but actively viewing content on the site. Most of the results from searching have to deal with php code in custom blocks for Drupal 4 or 5. Was this feature intentionally left out of Drupal 6 and beyond? Is it something I'm missing from within the administrative panel? I'd really like to code this myself if no such module exists, as it will be a good example to learn PHP. Any guidance is welcomed.

Comments

vm’s picture

adminsiter -> blocks

you have a who's new and who's online block already provided by core.

gbrussel’s picture

Thanks, I knew I'd missed something :)

bradnana’s picture

I would like to edit the who's online code to only show 'who's online'. I don't want a list of current users usernames online. Can someone tell me where I can find the code for that block?

Thanks

vm’s picture

check the user.module

bradnana’s picture

After spending about 2 hours rifling through the user.module file and attempting to customize the user_list function with a template override function, I finally realized that the 'online users' list can simply be disabled in the 'who's online' block configuration by setting the 'user list length' to 0. Sheesh!

Silly me.... he he

Just wanted to share my lesson learned in case others are looking for the same thing.

jafar104’s picture

But how do you customize the html? Right now it says "There are currently 1 user and 0 guests online." How can I change this output without touching the core?

vm’s picture

check the user.module to see if it's possible to override it with it a theme function. I don't recall whether it is or not.

markosaurus’s picture

user.module around ln 789 (using a custom user.module, so not certain on line numbers)

$output .= theme('user_list', $items, t('Online users'));

Don't see why you wouldn't be able to do this.