Hi --

Sorry if this is a fairly basic question. I have a custom profile field called "profile_fullname" which holds a user's real name. I'd like to use this field instead of the login name for the display of the authorship of a node.

I'm assuming it's fairly simple, but I am new to Zen. I had it working in Drupal 5.x but I remember it being a hack to do right.

Thanks!

Comments

ZippySLC’s picture

Any ideas? Even a point in the right direction would be a huge help. This is a showstopper for me launching with Drupal 6.

minesota’s picture

Some clues may be here http://drupal.org/node/47308

ZippySLC’s picture

Yeah, that link seems to really only give help for Drupal 4.7 and to a lesser extent 5. I'd like to know how to do this with Drupal 6 and Zen.

This entry in template.php in my old Drupal 5 site seemed to have done it. No idea how I replicate the functionality in Zen though.

<?php
function phptemplate_username($object, $link = TRUE) {
if ( !$object->profile_realname ) {
if ( $object->uid && function_exists('profile_load_profile') ) {
profile_load_profile($object);
}
}

if ( $object->profile_realname ) {

$name = $object->profile_realname;

    if ( $link && user_access('access user profiles')) {
      return l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
    }
    else {
      return check_plain($name);
    }
}
ZippySLC’s picture

Status: Active » Closed (fixed)

Never mind, the Realname module fixed it for me.

http://drupal.org/project/realname