Posted by davidbessler on March 7, 2010 at 9:38pm
| Project: | RealName |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Please see my image below. I read through the previous posts about this issue for previous versions, but the patches there don't seem to apply. Also, the ambiguous naming of this page is confusing. I call it the profile page, because it shows a user's profile. Some people are calling it the "my account page." It's URL on my site is: http://mysite.com/drupal/users/davidbessler
Real Name is working everywhere else on my site just fine. Can you help me?
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| Clipboard01.gif | 17.54 KB | Ignored: Check issue status. | None | None |
Comments
#1
subscribing
#2
Dave,
I was one of the people who posted the same issue several times. I never got any response and am still trying to figure it out and also why an issue like this that many have posted goes unanswered. I suspect that there is something you need to do with the template. I have also seen that several other modules have similar issues. For example, if you install facebook style statuses you will see the same thing.
If anyone is willing to find out why this issue is happening with realname and is willing to create a fix and post a comprehensive howto doc for the community I am willing to fund this. You can email me at gitotech@gmail.com
Thank you - chules
#3
Duplicate of? #601134: Pattern Does Not Affect Display of Real Name on User Profile
#4
Don't think so. That problem seems to deal with the formatting of the RealName. Our problem is that RealName doesn't show up at all on the /user page. Instead, the Username (not the Realname) shows up as the title on my user profile pages (or My Account pages , or /user, or whatever you want t call it).
#5
as per above
#6
Sorry for having changed the status (duplication).
#7
Does anyone have this working? Interestingly enough, the Real Name displays under any of the subcategories in user/ for example, user/79/contact works fine. user/79/messages works fine ... the Real Name displays on all of those, but user/79, shows the username as the title. Can someone tell me where this page is built? I looked through all of the core user module files and couldn't find it.
#8
Like many, I have come across the same problem and looking for the solution.
I also had another similar problem where the 'user/%/edit' page title in content profile was displaying the actual username and not the 'realname'. This was fixed by altering the 'drupal_set_title' function within the content profile code that was causing the problem. See the posts at: node/393518
I wonder if there is some similar code that sets the title for the 'user/%' page?
Fairly new to the drupal frame so any input appreciated, I'll be working on this week and will post any news.
#9
Headache
#10
I still do not have a solution to this problem.
#11
Still no solution
#12
Hi Drupalians,
Please help!, I am trying to include the email address of the user automatically in a html form, when he submit the content to the website. More specifically speaking I want to add a code which replaces with email address of the member who submits the form
eg: in the content type I will add a field with default data ; when the user submits the form It changes into user@website.com
Thanks
Vishnu
#13
Please remove #12 ... wrong thread.
#14
I'm close to a solution. The title of that page is in page.tpl.php
In that file, it tests to see if the page is front page ($is_front) and sets the title one way. If not, it sets it to something else.
How do I test if the current page is the /users/# page?
Also, what do I replace $title with to get RealName?
#15
Yay!!! I cracked it!
in page.tpl.php
I used this:
<?php
if ($title):
if ($is_front){/* if we are on the front page use <h2> for title */
print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>';
}
else if(arg(0)=="user") {
$account = user_load(array('name' => $title));
$title = theme('username', $account);
print '<h1'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h1>';
}
else {print '<h1'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .' </h1>'; /* otherwise use <h1> for node title */
}
endif;
?>
Which basically means:
if we're on the front page, use
for the style of the title
otherwise, if we're on a user page (where the url is .../users/somebody's username), change the title to the realname for that account
Otherwise if it's not the front page nor is it a user page, leave the title alone.
Kapish?
#16
davidbessler, thanks for sharing your nice snippet. It really helped :)
#17
Is there a way to do this in a preprocess function? I'd like to change $head_title as well without redoing what theme.inc does to set it.
#18
subscribing
#19
Thanks! This worked for me! I'm using Acquia Slate 3x and I added your lines to line 114 to 138 (actually I commented out the original title line which was the original line 114). The name is now acting as a link which is annoying, but I'm willing to have that on the site for the time being!
#20
I just found out though that using your hack makes it so the user's RealName doesn't show up on the edit page. :-( It shows as "Guest." It's also showing up as Guest in the track and contact pages!
<!-- The below section forces the User's First and Last name to show on their profile page as determined by the RealName module's fields family_name and given_name. -->
<?php
if ($title):
if ($is_front){/* if we are on the front page use <h2> for title */
print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>';
}
else if(arg(0)=="user") {
$account = user_load(array('name' => $title));
$title = theme('username', $account);
print '<h1'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h1>';
}
else {print '<h1'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .' </h1>'; /* otherwise use <h1> for node title */
}
endif;
?>
<!-- End of the configure the user's name hack. -->
<!-- Hiding the below for the user name. -->
<!-- <?php if ($title): ?>
<h1 class="title"><?php print $title; ?></h1>
<?php endif; ?> -->
This is what I have added and commented out in my code.
#21
Great work!
I've got this working now with your hacks - although other modules which provide tabs, in my case: fbconnect and twitter, still show the user name as 'Guest'.
How can I fix this? It's a bit worrying for users to see this!
#22
This hack has stopped working apparently. See here: http://www.lisuncg.net/icl/users/norma-jean where "Guest" is printed instead of the Realname of "Norma Jean." Please help!
#23
I'm seeing 'Norma Jean'.
#24
I'm having the same problem, also the Breadcum is always showing something like "Home > My Account > username", when it should be displaying "Home > username", because I'm not inside My Account, and the proposed fix always displays RealName but with a link, which I think is unnecessary.
If I recall correctly, RealName was one of the first modules I installed, and before installing LDAP Auth, Views, CCK and Panels it used to work correctly, so my guess is that one of this is making RealName behave incorrectly.
#25
Adding
<?php$name = isset($account->realname) ? $account->realname : $account->name;
drupal_set_title(check_plain($name));
?>
to your theme's user-profile.tpl.php file (you can just copy it from the core user.module) does the trick on RealName version 1.3.
#26
@Hanscraft : did you find a fix for 'guest' showing up on the edit pages?
#27
The problem with titling all user pages with a realname is that some user pages are expecting a uid of 0 or do not support realname and so default to the site config anonymous poster name - example user registration / login pages.
I've managed to at least change the word 'Guest' to 'Your Account' by adding another if statement:
if ($title == 'Guest') {print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. 'Your Account' .'</h2>';
}
else {print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>';
}
}
The string 'Your Account' works quite well as a coverall phrase both on login / registration and on User profile page tabs where contributed modules do not support realname.
#28
I think there are at least two problems that are causing this issue:
1) The function that generates the page content when you visit /user/? is normally user_view() in user module, realname module implements hook_menu_alter() and overrides this callback so that its own function, realname_user_view() is called instead - user_view() calls drupal_set_title() however realname_user_view() doesn't.
2) In the helper function _realname_make_name() a file called "realname_content_profile.inc" is included, this file contains the function content_profile_load_profile(), a little further on in the code module_invoke($module, 'load_profile', $account, $type) is called with the intention (I assume) of calling content_profile_load_profile() in the previously included file however module_invoke() is looking for that function in the content_profile module only and it doesn't exist so therefore nothing happens.
I've addressed these two problems in the attached patch which against 6.x-1.3, I'd appreciate if this patch can be tested, see if it fixes things for you :)
#29
This works for me. Realname now showing.
I'm using realname for the title of a content profile. Title on user/* pages weren't showing at all before, now realname shows.
Thanks matason.
#30
This doesn't work for me, because realname doesn't not always steal user_view. I added a few lines that place the drupal_set_title into hook_user, thus ensuring the correct title. It worked for me so on
#31
Thanks for the patch, it fixes most of my issues. I still have one, when a user is logged in and checks another user profile, the breadcum shows "Home > My Account > User realname", when it should display "Home > User realname". It only happens in the view, if I click on "Edit", the breadcum shows correctly.
#32
I think that's another issue, look for it in the list or create a new one.
I think this could be RTBC, IMHO
#33
Yep rtbc -- i can also confirm it fixes the problem.
#34
And here's a reroll against the current dev.
#35
I committed the addition to realname_user_view() since that matches the core behavior of using drupal_set_title(). I left out the change to realname_user('view') because that shouldn't be necessary for the module to work since core does not use drupal_set_title() there, so I'm also going to consider this fixed.
http://drupal.org/cvs?commit=442266
#36
Hm, just upgraded to the latest 6.x-1.x-dev (2010-Oct-27) but still have the username as the title of user/[UID] pages. Am I missing something?
#37
-dev rolls out at Noon and Midnight GMT (or 8 am and 8pm ET), so this commit hasn't rolled up quite yet.
#38
Yes, and the fix had been committed at 06:37 on October 27, 2010 (leading to realname.module 1.4.4.61). The dev rolled out around 14:00 on the same day and included realname.module 1.4.4.64.
#39
If you're using Content Profile, I just checked in a change to support overriding the title of the profile edit page.
http://drupal.org/cvs?commit=442866
Also, you have to make sure to rebuild your menus after updating (you can do this using admin_menu, or by running update.php).
#40
Automatically closed -- issue fixed for 2 weeks with no activity.
#41
Sorry to say, but I still have this issue with the latest 6.x-1.x-dev (2010-Nov-02), as shown in the attached screenshot.
#42
The latest dev version works like charm! Thanks Dave.
In addition to content profile tabs, I was also facing issues with facebook tab (facebook connect). I resolve the issue using the same approach that was used to resolve content profile issue. In this case, in realname.module, I intercepted function 'fbconnect_user_identities' (originally in fbconnect.pages.inc).
Here are the changes I did to realname.module:
Added a line case 'fbconnect_user_identities': after case 'content_profile_page_edit'::
/**
* Implements hook_menu_alter().
*/
function realname_menu_alter(&$callbacks) {
$callbacks['user/%user_uid_optional']['title callback'] = 'realname_user_page_title';
// Adjust menu page callbacks to the real name alternatives.
foreach ($callbacks as $path => $callback) {
if (isset($callback['page callback'])) {
switch ($callback['page callback']) {
case 'user_view':
// Skip if the Page manager module is installed, which needs to
// override
if ($path == 'user/%user_uid_optional' && module_exists('page_manager')) {
continue;
}
case 'user_edit':
case 'tracker_page':
case 'statistics_user_tracker':
case 'content_profile_page_edit':
case 'fbconnect_user_identities':
$callbacks[$path]['page callback'] = 'realname_' . $callback['page callback'];
break;
case 'contact_user_page':
$callbacks[$path]['page callback'] = 'realname_contact_user';
break;
case 'blog_page_user':
$callbacks[$path]['page callback'] = 'realname_blog_page';
break;
}
}
}
and then added the following function:
/*** Intercept the facebook edit page.
*/
function realname_fbconnect_user_identities($account) {
$output = fbconnect_user_identities($account);
drupal_set_title(realname_user_page_title($account));
return $output;
}
#43
I also still have the same issue with the latest dev
#44
me too, but #25 fix it.
#45
how should I apply #25 if I dont have user-profile.tpl.php on my theme?
#46
same here. What if I don't have user-profile.tpl.php in my theme directory?
Thank you,
Andrei
#47
create one: http://drupal.org/node/35728
user-profile.tpl.php
<?php$name = isset($account->realname) ? $account->realname : $account->name;
drupal_set_title(check_plain($name));
?>
<div class="profile">
<?php print $user_profile; ?>
</div>
#48
Yes, it works. Thanks you!
#49
It works. thanks a lot!
Andrei
#50
This finally works for me with RealName 6.x-1.4.
#51
Automatically closed -- issue fixed for 2 weeks with no activity.