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.
hi guys,
on my side i use nodeprofile to show the realname of a user on different places.
i also want to see the realname from my nodeprofile on the contact form.
why i dont see the realname? why i see the username?
on many other sections / modules i see the themed username automaticly.
regards
Lausch
Comment | File | Size | Author |
---|---|---|---|
#11 | contact-229660-10.patch | 831 bytes | wulff |
#4 | 229660-contact-theme-username-D7.patch | 1020 bytes | Dave Reid |
#2 | 229660-contact-theme-username-D7.patch | 1019 bytes | Dave Reid |
Comments
Comment #1
Dave ReidSeems valid. Marking to the current version of Drupal to patch then backport.
Comment #2
Dave ReidPatch ready for review.
Comment #4
Dave ReidMy bad.
Comment #5
j.somers CreditAttribution: j.somers commentedPatch works fine for me.
Comment #6
dawehneri tested the patch also and it works well.
i'm just wondering why using "<" instead of "<" does not work, can someone explain this?
Comment #7
dropcube CreditAttribution: dropcube commentedSimple patch, confirming RTBC.
Comment #8
webchickLooks good. Committed to HEAD. Thanks! Moving back to 6.x for consideration.
@dereine: We use < because this is output to the browser, and we're required to encode entities or else we break XHTML compliance.
Comment #9
Gábor HojtsyDid not apply to Drupal 6, but rerolled and committed.
I'd like to point out however that the page title is still the user's account name, not the real name even if theme_username() is overriden in other places. Since the theme function generates links if the user can view profiles, this cannot be used directly to set the page title (unless we want the page title to have a link of course).
Comment #10
webchickHm. Good point.
Moving back to 7.x, since we can at least fix this here. Also tagging as novice, since I imagine this is probably easy to fix. :) http://api.drupal.org/api/function/contact_user_page/7 looks like a good place to start; else maybe by adding a 'title callback' to the menu item like 'user/%user_uid_optional' has.
Comment #11
wulff CreditAttribution: wulff commentedI wonder if we could simply use filter_xss or something similar to strip the <a> tags from the return value of theme_username?
Comment #12
dixon_I've tested the patch in #11 and it works fine on a fresh D7 installation.
I still don't know if this is the preferred way to approach the problem. But this feels like a simpler solution than adding a title callback to the menu item. Am I right?
Comment #13
webchickHm. I think this will end up with
<a href="...">
showing up in your<title>
tags. I've asked Peter to take a look at this as well, since he's more well-versed in the D7 version of drupal_set_title().Comment #14
webchickComment #15
pwolanin CreditAttribution: pwolanin commentedusing filter_xss() will certainly be safe if that's the goal. By passing in no allowed tags, it will effectively strip all tags, plus do some other checks.
In fact, we will also run it through strip_tags() in http://api.drupal.org/api/function/template_preprocess_page/7 for the head title so the worry is not really that tags will end up in the
<title>
tag.Comment #16
pwolanin CreditAttribution: pwolanin commentedProbably this is fine for now - however, we should possibly as a separate patch add a parameter to theme_username to request the non-link form.
Comment #17
webchickHm. So when I actually tried this patch out myself, I found it a bit jarring.
I overrode the theme_username() function like so:
user/1/view: page title is "a"
user/1/edit: page title is "a"
user/1/tracker: page title is "a"
user/1/contact: page title is "bananas"
I'm thinking we'll want to escalate this to a larger "we should use the username coming out of theme_username() in user/X/Y" issue since fixing it only in Contact module looks very bizarre.
I've created a separate issue here for this: #464888: Use theme('username') in user profile page titles. I'm going to mark this issue fixed because the patch back in #4 was committed, but hopefully we can get some resolution over there for the larger user profile mis-match issue.