Working with Views module
ZippySLC - December 27, 2008 - 21:58
| Project: | RealName |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I have Realname working perfectly for all of my content nodes, but on pages generated by the Views module the author of the node still shows up using the drupal username instead of the realname.
I have seen this behavior in Realname 6.x-1.x-dev as well as the current stable version. I'm using Views 6.x-2.2.
You can see the issue on my test site at:
http://beta.njpinebarrens.com/articles/opinions
and it working perfectly for node content at:
Thanks!

#1
I used "user: name" with the option to link to the user and you can see what happened in the attached snap shot.
#2
That's how I have mine configured as well.
#3
Do you have "Override username theme" enabled?
#4
Yes. Additionally I also disabled and re-enabled both modules, unchecked "override username theme", saved the config, and then rechecked it and resaved.
#5
I am using Views 6.x-2.2 and the most current RealName. As you see in my attached screen shot above, it is working on my system.
#6
Well, as you can see from my screenshots, it's not working for me.
I'm just going to have views display "Profile: Full Name" and not care about the link to the authors profile.
#7
Are you sure you're using the latest -dev code?
#8
I had tried both the -dev code and the stable code. Same experience with both.
#9
Please open an issue against Views asking them to use
theme('username',...). Then RealName will intercept it and show the Real Name.#10
I just experienced the same problem with Views 6.x-2.3 and Realname 6.x-1.1.
However my problem suddenly disappeared... I had an existing view (created before installing the Realname module). When I updated several view settings and after saving them the problem disappeared. I'm very sorry but I don't remember all settings I changed, but I remember that I did rescan template files (Basic settings -> Theme: Information -> Rescan template files).
#11
I can confirm ahaapaka's solution, using the same version modules: Views 6.x-2.3 and Realname 6.x-1.1
Just by pressing Rescan template files, the views picked up Realname instead of username.
For more information about that Views button, see #271019: "Rescan template files" button. The screenshot in that issue shows you where the button is located in the Views UI.
Can we consider this bug fixed?
#12
#13
Sorry to reopen, this is the closest issue I have.
I am pulling user picture and username, the views fine with the realname displayed as expected. Now when I created a custom views template, views-view-field--bla--picture.tpl. It works ok with imagecache, see http://drupal.org/node/362991. But the the hardest part is the attributes. Views seem to ignore theme_username, instead uses the login name when it comes to print its row. Any idea how to fix it? Thanks
#14
I don't understand why you need any functionality of the RealName module for views.
#15
I have a concern to hide login name from public, instead use realname for the entire public view. This in return makes realname acts as public or display name. Login name is for the user and site internal usage only. Hope that makes sense. What do you think?
#16
I can make it work with user_load, but with a single field, I doubt if this is the best way.
Here is the revised code from the above link:
$user;
$uid = arg(1);
$account = user_load(array('uid' =>$uid));
if(!empty($row->users_picture)) {
//$profilename = check_plain($row->users_name);
$profilename = theme('username', $account, array('plain' => TRUE)) ;
$resized_pic = theme('imagecache','bigpic',$row->users_picture, $profilename, $profilename);
} else {
//$profilename = check_plain($row->users_name);
$profilename = theme('username', $account, array('plain' => TRUE)) ;
$resized_pic = theme('imagecache','bigpic','/files/noavatar.png',$profilename, $profilename);
};
$user_link = 'user/' . $row->uid;
print l($resized_pic, $user_link, $options = array(html => TRUE));
?>
Any suggestion to make it work without user_load? Thanks.
#17
In Views, when you select "user: name" there is a check box to "Link this field to its user." If you select that, it should use theme_username.
#18
gausarts, I am also using RealName to hide login names from the public and I have also set up a public user view (see https://www.iseki-food.net/drupal/board) that lists some users by their real name. I did not need any of RealName's functionality for this - that's why I am wondering why you do.
#19
Hi,
I did check the box, and as as I said it works fine when views displays it directly (out of the box) on the page, realname shows fine. But the problem comes when I need to give a certain different size and that's why I need to do some override from the default imagecache preset settings. I have to create a specific template for that particular need with particular override. And putting regular call to $row->users_name didn't reflect the realname, it falls back to login name.
There seems to be inconsistency when it comes to template override.
Hope I can make myself clear with that particular situation. Any hint? Thanks
#20
Have you opened an issue with Views? If so, please post the issue number here so we can track it.
I am not a Views expert by any stretch of the imagination. I have never attempted a template override.
#21
I have strange situation with Realname module and Views.
I'm using Views to listing recent comments on my site:
author (with link to user profile) -> title of comment (with link to comment)
If option "Override username theme" on Realname module configuration page are enable, then some authors in this listing don't have correct link to profile - only link to main page of site with title "View user's home page.". It's very strange, because on one page I see one author with correct link and with wrong link. If I turn off option "Override username theme", all links are correct.
#22
I think I need to double check that setting. I don't think "Override username theme" actually does much any more. There is another issue on where the username links to; that is probably the result of no longer doing user_load.
#23
I was enable "Overwrite user fields in view to show realnames" (this options was set successfully after applying patch from issue #462860: "Overwrite user fields in view" variable not setting in admin page) and I'm still have problem with Views type 'Comment': link to comment author's profile page was replacing with empty value. I thinks, it is because in Views I was enable option "Link this field to its user or an author's homepage" (works fine without Realname module) and Realname module in function realname_username at line 84 (realname_theme.inc) think, that $object->homepage is set and they try to replace comment author's profile link to comment author's website link.
I was change manually default value of 'homepage' to 'FALSE' in function realname_username at line 37 and its temporary solve my problem.
#24
I find that if in views, you check "Link this field to its user or an author's homepage", then it will display the realname. Otherwise it displays drupal username.
Is it possible to display realname without linking to its user homepage?
I have submitted a feature request to the Views module: http://drupal.org/node/591228
#25
I just applied #579040: Some bugfixes, which has some Views fixes. Please try the new -dev version when it rolls out later today.
#26
i was seeing the same issue as @dicreat in #23 - the comment author name url was an empty string when they had no explicit homepage set.
i am fairly sure it's because isset("") tests as TRUE and views is giving you an empty string for the homepage value. i changed the test of the homepage to !empty() in realname_theme.inc and the author name links to the user's account page now.
#27
Committed to 6.x-1.x-dev.
#28
Automatically closed -- issue fixed for 2 weeks with no activity.