The drupal_set_title in this code messes up RealName and is probably unnecessary.

function content_profile_page_edit($type, $account) {
//  drupal_set_title(check_plain($account->name));
  $node = content_profile_load($type, $account->uid);
  if (!$node) {
    $node = array('uid' => $account->uid, 'name' => (isset($account->name) ? $account->name : ''), 'type' => $type, 'language' => '');
  }
  return drupal_get_form($type .'_node_form', $node);
}

See #392464: No RealName on Content Profile edit tabs .

Comments

fago’s picture

Status: Active » Closed (won't fix)

I do think it's necessary.

nancydru’s picture

I commented it out and everything works correctly.

chules’s picture

where do you find this code to comment out? Is it in the content profile module

thank you - chules

nancydru’s picture

It is shown above.

chules’s picture

I meant what is the path and name of the file where this code exists? I am new to Drupal and still trying to figure my way around.

Thank you - Chules

nancydru’s picture

The path depends on where you store your modules. For me it is sites/all/modules/content_profile.module

brad.bulger’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new667 bytes

i am not sure why this line is necessary - without it, the page title is the user's name when editing someone else's profile and "My Account" when editing one's own, which seems correct to me.

but if you won't remove it, we can at least fix it to use theme(realname)

Bilmar’s picture

+1 subscribing - using theme username would be great.

YK85’s picture

Status: Needs review » Reviewed & tested by the community

setting status for #7 to rbtc
thank you

xjm’s picture

Tracking.

Edit: +1, #7 resolves the issue for me.

xjm’s picture

Title: Drupal_set_title unnecessary » Use theme('username') in drupal_set_title()

Better title.

fago’s picture

Status: Reviewed & tested by the community » Needs work

What's that array('plain' => true) for? First off the coding style says TRUE is uppercase, then theme_username doesn't have any options?

In general, +1 for using theme_username there too.

nancydru’s picture

If RealName is installed, that will result in the correct real name value being generated without a link. That was the original idea in the core issue discussion. Unfortunately, after I implemented that idea, they decided to take D7 in a different direction. This would work fine if RealName is installed, but if not, then you will end up with a link to the user page for that user. In this case something more like $name = isset($user->realname) ? $user->realname : $user->name; might work better.

brad.bulger’s picture

this came up in another module as well. yes, that patch is too specific to RealName for general purposes.

i am not sure how to apply your suggestion about setting the value of $name, though. i don't see where that would be happening?

for this drupal_set_title() call, i guess, pass it through strip_tags()? it seems wrong to be making a link and then tossing it but i haven't figured out a better approach. what i mean is to do

drupal_set_title(strip_tags(theme('username', $account)));
nancydru’s picture

  $name = isset($user->realname) ? $user->realname : $user->name;
  drupal_set_title(check_plain($name));
xjm’s picture

Status: Needs work » Needs review
StatusFileSize
new689 bytes

Here's a rerolled patch using NancyDru's code snippet in #15.

Works for me. Of course, we lose the flexibility of using the theme function.

xjm’s picture

Status: Needs review » Needs work

Eh, I really think there's a better solution out there that's more generalized, so setting it back to "needs work." Short of providing our own theme override (which seems to defeat the purpose...), the striptags(theme('username')); is the best I can think of.

I don't know why #7 works (rendering a plaintext username in the title instead of one with escaped tags), but it does.

Thankfully D7 supplies richer options for username theming.

fago’s picture

Status: Needs work » Postponed (maintainer needs more info)

Well actually I looked up why this call is necessary at all and it is so that the title stays when the user account edit integration is used - as the core user module also uses "drupal_set_title(check_plain($account->name));" on those pages.

Thus the question now is, how does the realname module alter the title on the other user/X/edit/ pages? Perhaps we can do it the same way here?

striptags(theme('username')) - brr, I'd really like to avoid something like that. In particular as core uses "drupal_set_title(check_plain($account->name));" too.

nancydru’s picture

As I stated in the original post, I don't think a drupal_set_title is needed here at all. The user module will set a default (poorly), and then RealName can fix it (hook_menu_alter). That is the simplest and most general solution. Take that line out and test it.

robby.smith’s picture

subscribing

paskainos’s picture

subscribing

fago’s picture

I tested it on the user/X/edit/profile page, but without the line the title was different?

nancydru’s picture

Different how? And was it unusable?

bramley’s picture

subscribing