I have set realname to override username theme and to show realname in nodes. But - for comments on the nodes I still see the username. It would be great if that could also be overwritten :)

Comments

lomz’s picture

On my site it is working, have you download the last version?

chrissearle’s picture

Yes - I have the latest (well - latest build - haven't tried a CVS checkout yet).

You can see here: http://www.speidermuseet.no/blog/hvem-er-denne-karen

The blog post byline and breadcrumb give the full name. Down at the bottom - there are a set of 5 comments - "Sendt inn av ..." shows the login name - not the full name of the user.

lomz’s picture

Both the blogarticle and the comments by the same author shows carsten.hp

chrissearle’s picture

I'm confused - here is what I see:

Top of post:

http://img.skitch.com/20081014-f1ys9ni14wyrbs49pc9n7k5ac5.png

Bottom of post:

http://img.skitch.com/20081014-qgn4p4sm3fd5ac5b63mha39keq.png

I see Carsten Pihl on all post points and in the breadcrumb but carsten.hp (and chris) in the comments.

So - a bit more digging.

I ran cron - and now - anonymous only sees the login name.

If I log in - I get the full name for the post but not the comments.

So - now I have two problems :) One is the original one the other I suspect to be a permissions issue somewhere :)

lomz’s picture

I actually have the same problem I just realised

bwicksall’s picture

I'm running Drupal 6.5 and usernames are not being overridden for comments.

chrissearle’s picture

OK - anon not seeing it in breadcrumb and node - that was me. It helps if anon has the "Use RealName" permission :)

But - comments - no. Logged in or not.

chrissearle’s picture

lomz - ref #1 - which exact version did it work for you with? I can't see anything in the 6.x-1.0 referring to comments - so I just wondered.

bwicksall’s picture

Ok, I see why it's not working. The comments are handled in the theme code (realname_theme.inc).

The problem is this section:

  if ($object->uid && !$object->realname && user_access('use realname')) {
    $account = user_load(array('uid' => $object->uid));
    $object->realname = realname_make_name($object);
  }
  else {
    $object->realname = $object->name;
  }

For me the problem is the "$object->realname = $object->name;" line. If I comment that out my comments work. "realname" has already been set but the logic in the if statement resets it to "name"

chrissearle’s picture

if ($object->uid && !$object->realname && user_access('use realname')) {}

Trying to work out how you come into the else.

One of

  1. $object has no uid
  2. realname is already set
  3. no access

We know that you have access - the node is working
I find #2 there odd. If $object->realname is set then you go into the else and unconditionally set it back to uid from what I can see?

lomz’s picture

I use the 6.x-dev

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Active » Postponed (maintainer needs more info)

@bwicksall: I believe you are right, that code should not be there.

nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fix committed to both branches.

lomz’s picture

Not able to see the difference

lomz’s picture

lomz’s picture

I commented out the part that makes trouble:

 if (module_exists('token')) {
    include_once(drupal_get_path('module', 'realname') .'/token_realname.inc');
  }

It still doesnt override in comments.

bwicksall’s picture

Thanks, the dev version appears to be working as expected on my version 6 site.

Bob

nancydru’s picture

@lomz: Did you try the -dev version? Did you clear your cache? As you can see bwicksall also sees it working.

lomz’s picture

It works

nancydru’s picture

Status: Fixed » Closed (fixed)