Closed (cannot reproduce)
Project:
Activity
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Dec 2009 at 06:15 UTC
Updated:
12 Sep 2010 at 01:18 UTC
The check for a username is:
if ($object->uid && $object->name) {
but my custom content type does not have a name field, so the check fails. Instead, it should call user_load() to load the user.
The code should look something like:
function theme_activity_username($object) {
if ($object->uid) {
if ($object->name)
$name = $object->name;
else
$name = user_load($object->uid)->name;
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($name, 0, 15) .'...';
}
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
return $output;
}
Comments
Comment #1
sirkitree commentedIf you have a custom content type provided by a module, then is should still have a ->name property... I fail to see the issue here. Please reopen if you care to explain further.