In the revision tab the usernames are themed, but in the diff inline block the usernames are not themed. I want this to work with Realname module.
Attached is a simple patch to fix this.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | diff-real-name-integration-971100-13.patch | 911 bytes | alan d. |
| #9 | diff-real-name-integration-971100-9.patch | 3.33 KB | alan d. |
| #3 | diff_theme_username_issue.png | 18.4 KB | arvinsingla |
| diff-theme_username.patch | 530 bytes | magnus |
Comments
Comment #1
realityloop commentedapplied to dev
Comment #3
arvinsingla commentedThis patch has introduced an issue for users who aren't using the realname module. The theme_username function is generating markup which is being placed in the select box. Unfortunately the stock theme_username function for D6 does not take extra parameters so the array('plain' => TRUE) does nothing for users who don't have realname installed.
This will affect admin users and users with the "Access user profiles" permission. See pic attached
Comment #4
realityloop commentedReverted.. feel free to supply a working patch
Comment #5
Hakaku commentedCouldn't you simply wrap it as such:
'@name' => module_exists('RealName')) ? $revision->name : theme('username', $revision, array('plain' => TRUE)),(not sure if 'realname' should be lowercase)
Comment #6
alan d. commentedMarked #1229206: Inline Diff block menu garbled html code instead of plain text options as fixed with the revert of realname patch.
Comment #6.0
mitchell commentedUpdated issue summary.
Comment #7
mitchell commentedComment #8
hass commentedNormally in D7 we should use http://api.drupal.org/api/drupal/includes%21common.inc/function/format_u... for formating usernames and this will allow realname to hook into. This does not required any module_exists() conditions. I'm not sure about the html code. May required strip_tags().
Comment #9
alan d. commentedThis patch appears to handle all fields - tested using Name Field modules real name integration.
Comment #10
kscheirerformat_username() says the code receiving this result is responsible for calling check_plain(). I don't think we need to pass in full
$accountobjects, since the$revisionobjects have a name defined, and format_username() saysComment #11
alan d. commentedAh, but these didn't show correctly when testing when passing the node itself, even though this has both uid / name.
Can you confirm that these work with the RealName module is used? Maybe there is a bug in the Name Field modules implementation. I ran tests with the current user being author and anonymous authors on content too.
i.e. revert to one of these forms and try.
But there is a issue with the patch with the first account load in diff_inline_form() - this should be $revision and not $node.
Related to check_plain(), can you expand on the issue please?
The code assumes that these are escaped by theme_username() by using "!".
As the string is escaped in theme_username() preprocesser template_preprocess_username()
And the one line that uses format_username() uses "@" to escape the string.
Comment #12
alan d. commentedOK, sadly it looks like you need to handle a user_load() within hook_username_alter(). I'll re-roll tonight, but please let me know what you think I missed with the escaping of the code.
Comment #13
alan d. commentedQuick re-roll. The I fixed the Name Field module "bug" [imho, this function should be getting a loaded user entity only, but core mixes and matches depending on the area] and retested.
Patch is reduced to just the user inline block code and uses format_username().
Comment #14
kscheirerThis patch worked for me, the "inline differences" block shows realnames where before it was always just a user name. You were absolutely right about not needing to escape the format_username, @name is sufficient - sorry about that.
Comment #15
alan d. commentedThanks, committed.
Comment #16.0
(not verified) commentedUpdated issue summary.