Once upon a time, with an older version of AdaptiveTheme, I got this to work by patching templates/comment.tpl.php
. The patch I was looking looked something like:
- print t('Submitted by !username on !datetime',
- array('!username' => $author, '!datetime' => '<time datetime="' . $datetime . '">' . $created . '</time>'));
+ if ( function_exists('user_access') && user_access('administer site configuration') ) {
+ $authorstring = 'Submitted by !username on !datetime from !hostname';
+ }
+ else {
+ $authorstring = 'Submitted by !username on !datetime';
+ }
+ print t($authorstring,
+ array('!username' => $author, '!datetime' => '<time datetime="' . $datetime . '">' . $created . '</time>', '!hostname' => $comment->hostname));
That was for a much older version of AdaptiveTheme (7.x-1.x, I think).
Thanks to hints from Laryn, I now have a working patch that does what I need. Here it is:
From 8c064aca6e2fd35da411473c5e50ce471d30d3cf Mon Sep 17 00:00:00 2001 From: Zed Pobre Date: Tue, 4 Nov 2014 02:54:21 -0500 Subject: [PATCH] Administrators see submitter IP addresses in comments --- at_core/inc/preprocess.inc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/at_core/inc/preprocess.inc b/at_core/inc/preprocess.inc index ef50fda..ba9b45e 100755 --- a/at_core/inc/preprocess.inc +++ b/at_core/inc/preprocess.inc @@ -832,13 +832,23 @@ function adaptivetheme_preprocess_comment(&$vars) { $vars['datetime'] = format_date($vars['comment']->created, 'custom', 'Y-m-d\TH:i:s\Z'); // Generate the timestamp, PHP "c" format is wrong - $vars['submitted'] = t('Submitted by !username on !datetime', - array( - '!username' => $vars['author'], - '!datetime' => '' . $vars['created'] . '', - ) - ); - + if ( function_exists('user_access') && user_access('administer site configuration') ) { + $vars['submitted'] = t('Submitted by !username on !datetime from !ipaddress', + array( + '!username' => $vars['author'], + '!datetime' => '' . $vars['created'] . '', + '!ipaddress' => ip_address(), + ) + ); + } + else { + $vars['submitted'] = t('Submitted by !username on !datetime', + array( + '!username' => $vars['author'], + '!datetime' => '' . $vars['created'] . '', + ) + ); + } // Unpublished? $vars['unpublished'] = ''; // Initialize for backwards compatibility if ($vars['status'] === 'comment-unpublished') { -- 1.7.10.4