Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Showing 'Anonymous' for the user is not as useful as simply showing the IP address/hostname of the visitor.
Compare this...
Time | Referrer | User | Operations |
---|---|---|---|
23 Feb 2009 - 21:34 | Anonymous | details | |
23 Feb 2009 - 21:34 | Anonymous | details | |
23 Feb 2009 - 21:34 | http://drupal.org/planet | Anonymous | details |
23 Feb 2009 - 21:33 | Anonymous | details | |
23 Feb 2009 - 21:32 | Anonymous | details | |
23 Feb 2009 - 21:30 | Anonymous | details |
to this...
Time | Referrer | User | Operations |
---|---|---|---|
23 Feb 2009 - 21:34 | 678.789.890.901 | details | |
23 Feb 2009 - 21:34 | 567.678.789.890 | details | |
23 Feb 2009 - 21:34 | http://drupal.org/planet | 456.567.678.789 | details |
23 Feb 2009 - 21:33 | 345.456.567.678 | details | |
23 Feb 2009 - 21:32 | 234.345.456.567 | details | |
23 Feb 2009 - 21:30 | 123.234.345.456 | details |
Would be a simple addition to theme_username():
function theme_username($object, $hostname = FALSE) {
...
else {
$output = $hostname ? $hostname : variable_get('anonymous', t('Anonymous'));
}
return $output;
}
Comment | File | Size | Author |
---|---|---|---|
#4 | 381802-theme-username-hostname-D7.patch | 7.63 KB | Dave Reid |
#2 | 381802-theme-username-hostname-D7.patch | 7.62 KB | Dave Reid |
Comments
Comment #1
Dave ReidThe node/%node/track SQL query can be written as the perfectly SQL-99 valid query and there would be no change needed for theme_username():
SELECT a.aid, a.timestamp, a.url, a.uid, (CASE a.uid WHEN 0 THEN a.hostname ELSE u.name END) AS name FROM accesslog a LEFT JOIN users u USING(uid) WHERE a.path LIKE 'node/%d%%'
Also would like to change this at admin/reports/dblog, and admin/reports/hits.
Comment #2
Dave ReidInitial patch for review. Changing theme_username seems to be the way to go because if I used the SQL in #1, an unwanted condition in theme_username would hit.
Comment #4
Dave ReidRe-rolled because user table name was rolled back to users.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedYup, just a little more useful. Thanks.
Comment #6
Dries CreditAttribution: Dries commentedI'm not convinced that should live in theme_username(). I think the caller of theme_username() should be made smarter instead.
Comment #7
JohnAlbinAfter a quick glance, I think this might be a duplicate of #192056: User's raw login name should not be output directly. But I'll let you guys make that determination.
Comment #8
Dave ReidNo this is quite a bit different from #192056: User's raw login name should not be output directly. Let's leave it separate for now.
Comment #9
akahn CreditAttribution: akahn commentedTo whom it may concern,
Work being done in #514928: Provide {comment}.hostname in comment_render() may make this task more do-able.
Comment #10
Dave ReidReverting title
Comment #11
Zed Pobre CreditAttribution: Zed Pobre commented#4: 381802-theme-username-hostname-D7.patch queued for re-testing.
Comment #12
Zed Pobre CreditAttribution: Zed Pobre commentedI requeued only to verify that the patch breaks as badly in the automated tester as it does on my own install. I wasn't intending to change the status.
Comment #13
mgiffordPushing this to D8. Would be nice if there was a hook that could be used to make this work in D7 mind you. Maybe it will be backported....
Comment #14
mandreato CreditAttribution: mandreato commentedSubscribe
Comment #15
japerryChanged issue format into filtered html because it was originally made with a user who had full html support, which blocks most users from commenting on an issue.
Comment #16
lauriiiI don't believe it is useful information for the user to show their IP for them.