I am using views, and I would like to display realnames as one of the columns (fields). I did not see realnames as an option, so I decided to try User: Name as the field to display.

Fortunately, for me, this does show realnames in the column as I had hoped.

But unfortunately for me, even though it shows realnames, when I clicksort the column, it sorts by the username, not the realname, so the shown names no longer look sorted.

I would like to display realnames, but have the clicksort sort by the realnames.

Where have I gone wrong?

Comments

iprosp’s picture

I was looking for it myself and i solved it by adding in sorting:
profile:General:NAME asc
Where NAME is the name that i gave to the realname field.
General is the profile category.

Don't forget to remove the sorting by username.

Hope it helps!

dpatte’s picture

Thank you, but unfortunately I also tried that, but my realname is composed of two profile fields:

Profile: User Information: First Name and
Profile: User Information: Last Name

In the view I have tried to get both fields, but that makes two fields and I want to sort on the composed realname, not just the first name or just the lastname. I have also tried getting both fields and hiding one while rewriting the other to show both, but it still only sorts by the original value of the part of the name I re-wrote.

I want to sort on the composed realname I have specified in the realname module that is made up of the first and lastname fields, and which it sems to show elsewhere on the site quite well.

iprosp’s picture

I have also tried getting both fields and hiding one while rewriting the other to show both

What if you tried to use views calc instead? You could create a new calculation(concatenating the two fields), which would create a new field. Then you could add the new field Views Calc: NewFieldName which views will see as one field from the beggining and then you probably would be able to use it as any other field.

nmalinoski’s picture

Issue summary: View changes

This issue is affecting me on the People page (User listing, Drupal core) with Real Name 7.x-1.2; sorting by Username sorts by username while displaying the Real Name override.

Edit: Oops; missed that this is Views-specific.

hass’s picture

Version: 6.x-1.5 » 7.x-1.x-dev
Category: Support request » Bug report
NWOM’s picture

I am having the same issue as described in #2 with the newest dev for drupal 7. Has anyone found a workaround for this in the meantime?

marco.b’s picture

As a workaround for correct sorting in views I recommend to use the user:realname field instead of user:name. this works for me.

NWOM’s picture

I managed to fix my issue as well when it comes to Search API indexed views. After applying #2512394: Add realname property getter callback to user entity, it was possible to index the Realname of the field. After having the realname indexed, it was possible to add the user:realname to the Search API view as well (similar to #7).