Download & Extend

Inline Diff meta block shows anonymous as the username

Project:Diff
Version:7.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The block to select inline diff colouring works fine - but when the new revision is shown on the main screen - the header with the legend in it always shows 'anonymous' as the username.

I noticed a previous post that showed a patch for the block - but I dont think the same change had been made for the inline diff metadata. I simply found that function and made the following change to replicate the other post. Sorry - I'm not sure how to make a patch so I couldn't supply one here - and to be honest someone with better dev credentials should definitely check my work..... But perhaps someone can check my code and make one, or let me know if its going to cause an issue elsewhere.

/**
* Display inline diff metadata.
*/
function theme_diff_inline_metadata($vars)........

in here

-- '!name' => theme('username', array('name' => $node)),
++ '!name' => theme('username', array('account' => $node)),

This problem may have been fixed in the latest dev version - but that is throwing me ajax errors so I cannot check - but thats for another post.......

Comments

#1

Ahh - of course this will just show the $node author - not the revision author..... so it will need more work.

I've checked the latest dev version code and these lines are the same.

I'm guessing we need something more like that used in diff.pages.inc ?

if ($revision->current_vid > 0) {
$form['info'][$revision->vid] = array(
'#markup' => t('!date by !username', array(
'!date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid"),
'!username' => theme('username', array('account' => $revision))))
. (($revision->log != '') ? '

'. filter_xss($revision->log) .'

' : ''),
);

Hopefully this is enough info for someone to suggest a solid fix - even if a bit all over the shot, sorry for that!

#2

Ok - I've looked at this a little bit more and seem to have a fix..... again - sorry for not supplying a patch - I haven't quite sussed that bit out yet.

On line 298 I made the change below :

-- '!name' => theme('username', array('name' => $node)),
++ '!name' => theme('username', array('account' => user_load($node->revision_uid))),

This loads the name of the revision author as opposed to the node author when showed in the headers meta data block.

#3

Just for clarity on the above!

file - diff.theme.inc

function - function theme_diff_inline_metadata($vars)

line 298

:)

#4

Status:active» postponed (maintainer needs more info)

I'm unable to reproduce this with the current dev version could you please try to recreate using that and confirm if it is still an issue?

#5

Status:postponed (maintainer needs more info)» needs review

I can confirm this issue. It popups when you use the inline diff block. The author name displayed in the inline metadata is always "anonymous".

The attached patch fixes this.

P.S. The inline diff feature is really nice! It will please the 50+ editorns on the project I'm working on now.

AttachmentSize
inline_diff_username_1242646.patch 589 bytes

#6

Status:needs review» fixed

thanks for the patch frjo, commited.

#7

Status:fixed» closed (fixed)

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

nobody click here