With most recent -dev release, all those little bugs were patched, but we got a new one...

Now, when going to a node, the page title which displays at the top of the browser window is correct, but the node title which displays on the page is no longer the content title, but is instead the Real Name of the currently logged-in user.

While it's somewhat amusing to have my name at the top of every node, it's not the most ideal feature.

Comments

roball’s picture

Can confirm this bug. Subscribing to this issue.

stopbox’s picture

Also subscribing, I have the same problem.

roball’s picture

Component: Performance » Code
Status: Active » Needs review
StatusFileSize
new2.63 KB

The attached patch against the latest 6.x dev version fixes the problem for me.

I have removed the "My account..." option because it is not needed anymore: The module now behaves exactly as Drupal without this module enabled - only with the username replaced by the realname. In the navigation menu, the link to the user profile page is always labeled "My account" (as in pure Drupal). Within the user profile pages, the title of the page is the realname (pure Drupal would display the username there). The original version did not distinguish between these two cases.

roball’s picture

Title: Real Name replaces node title on nodes » Title of all pages is set to real name
Priority: Normal » Critical
stopbox’s picture

#3 Works for me. Thanks.

snorkers’s picture

Had spent a whole day deep in my Theme wondering where the text 'My Account' had appeared from in $title... now I know. Just feel a little seen off that my name wasn't in lights on every page.

Equ’s picture

When is the next -dev release?

nancydru’s picture

Dev releases get created every time I commit changes.

@roball: "My account" is now a setting. You may turn it off if you don't like it.

nancydru’s picture

With which themes are you seeing this behavior? My D6 development site is using Garland and it is not doing this for me.

roball’s picture

Nancy,

I'm using the "Pixture Reloaded" theme (http://drupal.org/project/pixture_reloaded). Now working fine with my patch posted above.

Equ’s picture

I'm having this issue with Framework theme.

roball’s picture

Equ, did you try my patch?

snorkers’s picture

I first noticed it in my own custom (Zen-based) theme... but tried it in Garland too - and $title is changed to 'My account' on every page. I haven't tried the patch yet, but disabling Realname module restored $title to its expected value.

bobgeier’s picture

Bug confirmed on Garland, Marinelli, Pixture Reloaded, Aquia Marina. It's not theme-based.

When accessing the site as an anonymous user, realname performs just grand. Logged in as any role of authenticated user and you get the user's realname (or "My account" depending on the setting) as the node title on every page.

Tried the patch briefly but must have keyed it in wrong and got phperroredwhitescreenofdoom. :) Mean to get back to it but haven't had a chance yet.

Equ’s picture

Roball,

no, I didn't. I'm waiting for the next dev release.

roball’s picture

bobgeier, my patch is against the latest current dev release (CSV version 1.4.4.34 of "realname.module") and meant to be applied from Drupal's home directory (referred to as "/path_to_your/drupal" below - may be something like "/var/www/drupal"). So here are the commands to execute it properly:

cd /path_to_your/drupal
wget 'http://drupal.org/files/issues/378938.patch'
patch -p0 < 378938.patch
nancydru’s picture

I am trying to figure out how to rework the patch because I like the "My account" option, although I agree that it may not be the best title (possibly it should be a setting).

bobgeier’s picture

Thanks, roball! The patch works for me, though the profile page (/user/#) of the currently logged on user displays a node title of "My Account" rather than real name. Nancy likes that, I think, though I'd prefer the option to shut it off and just use realname. I'd vote for that if it's possible to add, but it's honestly a minor issue.

roball’s picture

I guess Nancy is currently working on that and she will probably release it in her next dev version soon.

roball’s picture

Status: Needs review » Reviewed & tested by the community
roball’s picture

StatusFileSize
new2.76 KB

bobgeier, until Nancy publishes her new dev version, you may want to use the attached patch (http://drupal.org/files/378938-2.patch) instead. It always displays the real name instead of "My Account" on the expected places.

nancydru’s picture

@bobgeier: There is an option to turn it off. It's on the settings page. However, I am about to change it so that you can enter whatever text you want for the title.

nancydru’s picture

@roball: I only intercept the title when the menu path is "user/%user_uid_optional" how can that possibly be affecting "node/%node"? I believe you that you are seeing something like this, but I cannot see how RealName is causing it; certainly it is not happening on my sites.

roball’s picture

Nancy, it's because you are executing drupal_set_title(check_plain($name)) on each and every page.

When you will add this option, what about the possibility to use a placeholder for the real name in the custom text - something like "!realname's account"?

nancydru’s picture

Where am I doing that? The only places I should be setting the title is on the user pages. Which release of Drupal are you using?

roball’s picture

Here. I am using D6.9 and will update to 6.10 tonight.

nancydru’s picture

That is in the user page title code and should not affect any node pages unless some other module is messing with the menu.

avpaderno’s picture

The code is not changing the $node->title property, nor it's calling any Drupal functions that change it.

nancydru’s picture

@roball: The original on/off setting has been there for some time. The new version will be rolled up this evening, but has already been committed if you are using a check out.

roball’s picture

StatusFileSize
new647 bytes

As I have reported repeatedly, the drupal_set_title(check_plain($name)) *is* in fact the bad part of code that is causing writing the username on each and every page's title, still in the new dev version 6.x-1.x-dev (2009-Feb-27). The attached patch against this latest version just removes that line of code and the problem will be gone.

nancydru’s picture

And, as I have repeatedly said, this is NOT happening on any of my sites. Further, that code is specific to "user/%user_uid_optional" so if it is firing elsewhere on your site, I need to know why before I possibly break someone else's site.

With that line removed, the "My account" feature does not work; the breadcrumb updates, but the page title does not.

roball’s picture

I cannot say why that line of code changes the title on all of my pages, but it definitely does - and as you can read in this thread, I am not the only one being affected. Others already turned out that it is independent of the used theme, and it happens also with the latest Drupal core.

I have posted a solution in my first patch above that does not break any existing site nor the "My account" feature.

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work

I cannot say why that line of code changes the title on all of my pages

If you don't know if any other module is messing with the menu router, why do you keep to think the bug is in this module?
The fact somebody else using the same module doesn't have the same issue you have shows that the issue is not in the module, otherwise all people would see the same issue you have.

Like reported by the maintainer, the function you are referring is called in a menu callback associated to user/%user_uid_optional; it cannot be called on node pages, which have a menu path matching node/%node.

Finally, the patch (reviewed & tested by the community) status should not set by who submitted the patch.

roball’s picture

For me it does not play a role if the original source of this problem was caused by another module or by this one, as long as I have a working solution. Until v1.4.4.32 there was no problem. While no changes have been made to the other modules, the problem began to arise with v1.4.4.33, which introduced drupal_set_title(check_plain($name)), as part of the commit labeled as Make "My account" an option.

Commenting out that new line still introduced the "My account" option, so I can't see the relationship of this code line to the mentioned change. But it fixed the new problem for me. In the patch I submitted first, I am still using that function, but in a way where I don't have the problem, while still trying not to break its functionality if there is any. The next code change has been committed without a chance to be tested by users affected by the problem (including me) - so it's now again in the official dev version. There is nothing more I could imagine to do now. I have a working solution, but you don't seem to accept it. If your problem is this issue being reported as "bug report", you may feel better to read it as "workaround" - but this category does not exist to choose from.

nancydru’s picture

does not play a role if the original source of this problem was caused by another module or by this one

I understand your frustration; I am frustrated by this as well. Please bear in mind that while you have one user to make happy (yourself), I have over 600 users of this module. I may very well have to remove the "My account" option, but it would make a big difference if I could reproduce this so I could find out why pages that have no business being in this code are there.

Actually, you gave me a hint in your last post. I am not on the latest core because 6.8 complained about a problem with one of the cache tables. I need to try the latest again and see if it is fixed or I can fix it somehow. Perhaps the problem is actually caused by a release newer than my 6.6. Remember that the bulk of the most recent changes that caused all this is the result of trying to bypass core bugs. So I'm going to concentrate on getting up to the current core version.

avpaderno’s picture

I notice the same problem on Drupal 6.9. All the pages have the title set to the name of the user currently logged in.

nancydru’s picture

I believe that you both are seeing this. I just upgraded to 6.10 and still cannot reproduce it. However I still see that removing that line of code causes the titles on the user pages to be incorrect.

avpaderno’s picture

Can the issue be caused by some Drupal settings? Could be it caused by the use of the cache?
I installed the module on a test site that uses just Drupal core modules, so it cannot be caused by the interference with third party modules.

roball’s picture

Kiam@avpnet, now you say

I installed the module on a test site that uses just Drupal core modules, so it cannot be caused by the interference with third party modules.

but 5 posts above you just said

The fact somebody else using the same module doesn't have the same issue you have shows that the issue is not in the module

So what?

silkyD’s picture

Status: Fixed » Needs work

I was having exactly the problem described by Roball and his patch at #30 fixed it. User page titles are correct, and the rest of the pages have their correct titles as well. I'm using 6.9 and a Zen subtheme.

NOTE: Sorry, I should have been more specific: The issue was that the name of the logged in user was displaying as the page title and node title on each and every page. Commenting out the line 'drupal_set_title(check_plain($name));' in the 'realname_user_page_title' function as described in Roball's patch negated the problem.

nancydru’s picture

@silkyD: If you are using the "My account" option, they are not correct, but your breadcrumbs will be (try a slightly different string).

@Kiam@avpnet.org: Hmm, interesting. My test site is close to a vanilla site.

@roball: Do you know how to do tracing? I'd like to know how the user_page_title code is being entered from a node page.

avpaderno’s picture

@#39: I was referring to the maintainer of the project, not to me. I was simply saying that, as there is somebody who doesn't have the issue you are describing, you should give more informations to resolve the issue.

To verify if the problem was really caused by the module, I installed it on a test site where there are just Drupal core modules installed.

snorkers’s picture

There are probably many lurkers on this issue who may be staying quiet.

I've had Realname running latest DEV for a while and have 'My account' on every page title. Just upgraded to D6.10 and problem still there.

In absence of being able to contribute much to debugging (not really experienced in PHP/modules), I would say it's more important to remedy the erroneous page titles than have 'My account' on my account page. It's a really nice feature, but just not as important. So if it's turning out to be a real problem to track down, then just allow the feature to either be disabled, or drop it (iaw the patch @#30)

If I could help more, I would, but for the moment Realname has to - unfortunately - stay disabled in my currently-underway site :-(

nancydru’s picture

Status: Needs work » Fixed

It has been removed.

roball’s picture

Status: Needs work » Active

New dev version (realname.module 1.4.4.36) has introduced a new critical bug: now nothing is displayed at all for the own user pages. Nancy, why don't you give us a chance to test your changes *before* committing them?

roball’s picture

Status: Active » Needs review
StatusFileSize
new1.26 KB

And here is the patch against version 6.x-1.x-dev (2009-Feb-28) that fixes the newest bug. This actually brings us back where we already could have been with my patch at http://drupal.org/node/375692#comment-1263014

vm’s picture

marked http://drupal.org/node/386814 as a duplicate of this issue

nancydru’s picture

There is no variable named 'realname_myacct' any more. That code was removed from the admin function.

And, once again, this is not happening on my sites.

roball’s picture

Nancy, we know this - you should really have a look into my latest patch and apply it asap. Otherwise, probably 599 of your users can't use your module.

nancydru’s picture

Your patch uses that variable. What I did was to remove the setting and the two places it was used and removed the drupal_set_title. Without the title change, the "My account" feature did not work, so I removed it.

You can apply for CVS access and I will give you this module.

lomz’s picture

Subscribing.

bobgeier’s picture

Easy, folks.

NancyDru & roball, we all appreciate your work on this.

I'm not experienced enough with pHp to try to figure out where things are leaking. I can say that roball's patch in #21 seems to make the module fully functional for me in Drupal 6.9 with the Content Profile module, so I'm staying with that for now :). Like a few others, I can help with some testing in various modes; it would be nice to get these kinks worked out and have a fully-functional release.

Kiam, I wasn't clear... were you saying you WERE able to duplicate the problem on a clean site, or not? If not, I'm wondering if there's a connection with Content Profile.module, which does at some level link node and user (?)

avpaderno’s picture

I am sorry if I didn't understand what you meant.
I don't have Content profile on my test site, but I have Devel; I also noticed the problem of having the title of all pages being changed the name of the user browsing through Drupal pages.

I don't understand why this happens, as the code of the module seems to correctly set the title only for user pages.
I also find quietly strange that the behavior appears in some sites, and not in others.

nancydru’s picture

@bobgeier: You can't just look at the title. You need to hover over the title and breadcrumbs to see if they are right. When I went with just removing the drupal_set_title, the breadcrumbs were wrong. That's when I removed all of the "My account" feature. Without that, the breadcrumbs are right and the title is right - at least on all my sites.

NickSI’s picture

It seems that I've found the source of the problem roball has been trying to fix with his patch. If you look on the code responcible for altering user page menu item

/**
 * Intercept the user page title.
 */
function realname_user_page_title($account) {
//  $myacct = variable_get('realname_myacct', NULL);
//  if ($account->uid == $GLOBALS['user']->uid && $myacct) {
  if ($account->uid == $GLOBALS['user']->uid) {
//    $name = t($myacct);
  }
  else {
    $name = (isset($account->realname) ? $account->realname : realname_make_name($account));
  }
//  drupal_set_title(check_plain($name));
  return check_plain($name);
}

you'll see that in the latest dev release $name variable which should contain either user name of 'My Profile' words left unitialized in latter case (row 5). I think the best way will be to replace commented line with $name = user_page_title($account) in order to use default title from users.module

lomz’s picture

After that changed the "My account" on top of Navigation-menu disappeared, just leaving the

    -dot alone.
roball’s picture

Yes NickSI - you seem to really got a look into my patch. Actually I just corrected the wrong commenting of Nancy's last commit in my last patch. Her result still reads

  if ($account->uid == $GLOBALS['user']->uid) {
  }
  else {
    $name = (isset($account->realname) ? $account->realname : realname_make_name($account));
  }

which I simply corrected to

$name = (isset($account->realname) ? $account->realname : realname_make_name($account));

That's all - and I am *not* using the variable mentioned by Nancy in #50. The problem now is that "removed" code got into CVS without checking to be correct and then my patch has not been reviewed properly...

nancydru’s picture

@NickSI: Thanks, but the main reason why this function exists is because the one you suggest doesn't work.

@roball: Here's part of what I see in your patch:

 function realname_user_page_title($account) {
-//  $myacct = variable_get('realname_myacct', NULL);
-//  if ($account->uid == $GLOBALS['user']->uid && $myacct) {
-  if ($account->uid == $GLOBALS['user']->uid) {
-//    $name = t($myacct);
+/*
+  $myacct = variable_get('realname_myacct', NULL);

That says to replace the commented "$myacct" with the uncommented, thus trying to get a variable that no longer exists.

And yes, I did test the code before I committed it. It works correctly on my sites, but then I wasn't seeing the problem that was initially reported here either (and which is still unexplained).

I would prefer that we stop being adversarial here.

nancydru’s picture

StatusFileSize
new1.95 KB

Try the attached patch, please.

roball’s picture

Nancy, isn't

  if ($its_true) {
  else {
    $my_var = 'I only get a value if $its_false, otherwise I\'ll stay empty';
  }

obviously a bug? What I did is actually repairing the above to something like

    $my_var = 'I always get a value';

- nothing else. The relevant cited part of the patch must be continued until the line

+*/

so you finally get

function realname_user_page_title($account) {
/*
  $myacct = variable_get('realname_myacct', NULL);
  if ($account->uid == $GLOBALS['user']->uid && $myacct) {
    $name = t($myacct);
  }
  else {
    $name = (isset($account->realname) ? $account->realname : realname_make_name($account));
  }
  // ATTENTION: The following line may activate the bug discussed at node/378938
  drupal_set_title(check_plain($name));
*/
  $name = (isset($account->realname) ? $account->realname : realname_make_name($account));
  return check_plain($name);
}

Do you see it now what I really did?

nancydru’s picture

Okay, I read it wrong (life has been very hectic lately). I think we've ended up in the same place, except I've removed the commented code.

nancydru’s picture

Status: Needs review » Fixed
roball’s picture

Thank you Nancy for your continued effort. The latest dev version (realname.module v1.4.4.37) works fine for me :-)

nancydru’s picture

Fabulous. Thanks for the update. I don't suppose you've tested #385126: Cache user_load or do something smaller...?

joostvdl’s picture

The link in Navigation Block is in the latest dev release still set to the Realname and not to the text: My Account. How can I change it back to the default Setting because this is nog logical I think because clicking on your own name to go to the My Account page is confusing for users.

joostvdl’s picture

Status: Fixed » Active
vm’s picture

couldn't you just create a new MyAccount link and point it to the /user/ path ?

roball’s picture

Status: Active » Fixed

+1 for #67

nancydru’s picture

Strange coincidence... I was working on a new site and saw an entry in the menu with my name. Yes, it turned out to be the "My account" entry. Just to see, I went to my test site - using the exact same code base and same PC - and it is not happening there. Very curious!

My experience with users click on "My account" is that they don't.

On this site I am using the theme override on the Navigation block, which give them the equivalent of "My account" at the top of the block, so I just deleted the "My account" link.

nancydru’s picture

Well, at the risk of breaking roball's site again, I committed a fix.

roball’s picture

It didn't break anything for me this time :-) However, the latest commit acts like a downgrade of functionality for me, since I preferred to see the real name instead of a fixed string, just as it is done by other CMSes we use, such as Moodle. Would you care to make this optional again (but without the problem we had last time)?

Thanks.

nancydru’s picture

Status: Fixed » Postponed (maintainer needs more info)

Are you talking about on just user page or the menu item too?

roball’s picture

I only meant the link's title in the menu.

nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

Committed

roball’s picture

Everything works fine for me this time! Thanks Nancy.

nancydru’s picture

Fabulous

roball’s picture

Do you think time is now ready to roll out a new release?

nancydru’s picture

Status: Fixed » Closed (fixed)
andrenoronha’s picture

I use RealName 6.x-1.2...
will this patch come as default in a soon-to-come release?

nancydru’s picture

It's already in 1.2.

andrenoronha’s picture

OK...
i got this problem: the admin users and the users created by an admin user have their realname at the HTML page title...
but the new users that have created their own account have no page title... it shows only "[the name of the site] - -"

I created a role for users that havent yet atenticated themselves by the email sent to them...
is there any problem about the atentication of the new users that's making them not truely registered users?
I use logintoboggan btw...

ingopingo’s picture

subscribing

same problems (username - not real name - appears on any teaser title) with acquia prosper. The title of the full node works as normal.

roball’s picture

@ingopingo: You are describing another problem that is not related to this one (which has already been solved).

ingopingo’s picture

Hi,

my problem is already solved? I've searched but not found anything similar...

Could ypu point me to the thread, please?

roball’s picture

Please read carefully and think before writing wrong things into wrong places.