Download & Extend

Who's online block should never report anonymous users

Project:Drupal core
Version:7.x-dev
Component:user.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Anonymous don't, in general, have a session any more. Therefore it's not possible to count how many there are.

The Who's online block always displays the number of (registered) users, but for some reason #201122: Drupal should support disabling anonymous sessions made the block also display the number of "guests" when (and only when) page caching is disabled. This code can I think all be safely removed. The <h3> heading "Online users" in the block itself can also probably be removed.

Comments

#1

Status:active» needs review

Here is a patch that removes the code described above

AttachmentSizeStatusTest resultOperations
590092.patch2.42 KBIdleFailed: Failed to apply patch.View details

#2

Status:needs review» needs work

The last submitted patch failed testing.

#3

Status:needs work» needs review

rerolled

AttachmentSizeStatusTest resultOperations
590092_0.patch2.46 KBIdleFailed: 13462 passes, 1 fail, 0 exceptionsView details

#4

Status:needs review» needs work

The last submitted patch failed testing.

#5

Need to remove code for anonymous users/sessions from user.test, including 1 assertion. Also there is text output onto the block's configuration page, and also on the system performance page, about the interaction with page caching, that needs to go.

#6

Status:needs work» needs review

reroll with user.test changes and the block configuration change.

I'm not seeing the interaction with page caching on the system performance page though.

AttachmentSizeStatusTest resultOperations
590092_1.patch4.86 KBIdleFailed: Failed to apply patch.View details

#7

Status:needs review» needs work

>I'm not seeing the interaction with page caching on the system performance page
Yes I'm not seeing it either, for some reason it's not working and I just get a few errors such as:

Notice: Undefined index: page_cache in block_form_system_performance_settings_alter() (line 830 of /home/gelstgpk/public_html/drupal-7.x-dev-28Sep09/modules/block/block.module).

The code is there in block.module, see http://api.drupal.org/api/function/block_form_system_performance_setting...

#8

rerolled. @gpk, I removed all the code you suggested.

AttachmentSizeStatusTest resultOperations
590092_2.patch6.01 KBIdleFailed: Failed to apply patch.View details

#9

Status:needs work» needs review

#10

Status:needs review» reviewed & tested by the community

This removes some horrible text that few people will understand, and a feature that will make zero sense with the new session handling - if you have page caching off, and that block enabled, then your site makes no sense. It's a bit of a shame, because that block is nice for vanity, but not enough of a shame to stop this being RTBC.

#11

This patch needs a quick re-roll.

#12

Status:reviewed & tested by the community» needs work

#13

Status:needs work» needs review

rerolled.

AttachmentSizeStatusTest resultOperations
590092_3.patch5.74 KBIdlePassed: 13715 passes, 0 fails, 0 exceptionsView details

#14

Status:needs review» reviewed & tested by the community

reRTBCed.

#15

Status:reviewed & tested by the community» needs work

<?php
-          $output .= theme('user_list', array('users' => $items, 'titles' => t('Online users')));
+         
$output .= theme('user_list', array('users' => $items));
?>

?!?

#16

@Damien, not sure what I should do here. I removed the title stated in the original bug report.

#17

Status:needs work» needs review

Oh yes, I see what Damien is asking.

Currently the block might look something like

WHO'S ONLINE
There are currently 3 users and 8 guests online.
Online users
- Damien
- Dries
- Moshe

What I proposed in the original issue was that the h3 "Online users" is now superfluous, since the block will only ever report online users, as follows according to my suggestion:

WHO'S ONLINE
There are currently 3 users online.
- Damien
- Dries
- Moshe

#18

Status:needs review» fixed

The patch looks correct to me. Not sure what DamZ comment was about, but we can follow-up on it if necessary.

#19

Thanks Dries, possibly Damien hadn't realised that the removal of the "Online users" heading was intentional, or perhaps he was (also) flagging up the incorrect key 'titles' passed to theme_user_list in the original (should have been 'title'). Either way I think this is correct now.

#20

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.