username.tpl.php - it seems broke :(
as part of my early adopter pack (tutorial 1) i seem to have username.tpl.php - it wasn't in a later download....
but it dosn't seem to be working now... any ideas?
<?php
if ($object->uid && $object->name) {
$profilename = $object->name;
// If the user has a full name defined, use that
//Change the following two lines to load your fullname from wherever
//it is stored and put it to $fullname..
$account = node_load(array('type'=>'uprofile', 'uid'=>$object->uid));
$first_name = $account->field_first_name[0]['value'];
$fullname = $account->field_first_name[0]['value'] . " " . $account->field_familyname[0]['value'];
//Change - end of your modifications. $fullname should contain the name..
$username = $fullname;
if (!empty($fullname)) {
$profilename = $fullname;
}
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($profilename) > 20) {
$name = drupal_substr($profilename, 0, 15) .'...';
}
else {
$name = $profilename;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if ($object->homepage) {
$output = l($object->name, $object->homepage, array('title' => t('View link')));
}
else {
$output = check_plain($object->name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = variable_get('anonymous', 'Anonymous');
}
//remove the "test" string below - this is to make sure that this code
//is kicking in as needed.
//print "test: " . $output;
print $output;
Site contents are licensed under a
I'll rephrase that...
I just re read that and i even have a time understanding it...
so...
Question: How do i display real names not user names please?
Real name
That wasn't part of my tutorial. Just from looking at the code you posted, I'm guessing it's overriding theme_username() and it looks like it's loading the usernode for the user and finding first/last name fields on there and using those to override the displayed name.
You could do the same thing with nodeprofile, just load that node instead. I can't get more specific off the top of my head but wanted to at least answer the post. I'm sick and traveling so not up to much support right now.
Michelle