Registered users displayed as Anonymous

jajathejazzcat - March 6, 2009 - 13:48
Project:RealName
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)
Description

When a value in real name field in profile module is set once but deleted later, an empty string remains in database.
So when the function realname_make_name is called, isset returns true around line 267.

    if (isset($account->$name) && !$private_field) {
      $stuff['%'. $i] = $account->$name;
    }

This causes the return value of realname_make_name, and static var $users[$account->uid] to be an empty string, which later causes $node->name and $node->realname to be empty when the script goes through hook_nodeapi. So when I use theme('username', $node), the result is 'Anonymous', rather than the name of a registered user with a link. It also causes theme('username', $account) to display non-link with 'not verified'.

It took me a while to figure this out since I kept thinking I did something wrong in my customized theme.
Of course I can easily solve this issue by setting the realname field required, but in order not to let anybody else encounter the same problem, is it possible to use !empty instead of isset like the following?

    if (!empty($account->$name) && !$private_field) {
      $stuff['%'. $i] = $account->$name;
    }

I'm not sure if this change causes other issues, but it's been working for me. Thanks!.

#1

NancyDru - March 6, 2009 - 17:33
Status:active» patch (to be ported)

You probably should have both "isset" and "!empty" because "empty" could raise a warning for those who have their error reporting set that way.

I will commit this to 5.x whenever someone tells me how the autocomplete testing is going.

#2

a.luiz.n - May 14, 2009 - 17:58

hey is it because of this that I have nothing at the user page html title and at the "to:" field of the contact form?

it's seems to me that the user who created their own account are not being recongnized as true authenticated users. Only the new users created by an admin account have their name at the html title of their page...

does realname have something to do with that??

#3

NancyDru - May 14, 2009 - 18:10

A) Did they complete their profile fields?
B) What happens if they log out and back in?

#4

a.luiz.n - May 14, 2009 - 20:43

yes, the Realname field is mandatory.
And nothing happens when they logout and login...
when they're in their user page the html title shows "My accont" but when their user page is being viewed by another user the html title shows nothing...

#5

redijedi - June 18, 2009 - 02:09
Version:5.x-1.1» 6.x-1.x-dev

Same problem for the 6x version. I upgraded to dev and still see the issue as of June 17.

#6

redijedi - June 18, 2009 - 03:48

I found that auth'd users require the view user profiles permission. Now it seems to work ok.

#7

a.luiz.n - June 18, 2009 - 17:38

where can I set the view user profiles permission?
at my permissions page i don't see the conte profile module...

#8

a.luiz.n - June 18, 2009 - 19:28

i tried some tokens in the user page title pattern like user tokens and cck fields tokens
but the thing is, i integrated the user profile inside the user page. so cck fields are not shown in the user page title pattern.

so i used the token [user]. it shows the user name. but it should show de realname as this is its job.

help?

 
 

Drupal is a registered trademark of Dries Buytaert.