Closed (works as designed)
Project:
Activity
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2010 at 22:26 UTC
Updated:
25 May 2010 at 04:56 UTC
diff -wBNru activity/modules/node.activity.inc ../activity/modules/node.activity.inc
--- activity/modules/node.activity.inc 2009-09-22 11:26:16.000000000 -0400
+++ ../activity/modules/node.activity.inc 2010-01-14 17:19:49.000000000 -0500
@@ -34,7 +34,7 @@
if ($type == 'node') {
return array(
'activity-node-link' => l($object->title, "node/{$object->nid}"),
- 'activity-node-creator-link' => theme('activity_username', $object),
+ 'activity-node-creator-link' => theme('activity_username', user_load($object->uid)),
);
}
}
Comments
Comment #1
fizk commentedSorry, the title should be "Patch node.activity.inc to display usernames"
Comment #2
Scott Reynolds commentedthat shouldn't be needed. For instance, theme('node_submitted') calls theme('username') with just the node object
http://api.drupal.org/api/function/theme_node_submitted/6
If you need that then your theme('username') is messed up?
Provide more info on why this is needed.
Comment #3
fizk commentedWithout this patch, an unmodified 2.x-dev will show "Anonymous" instead of the user's name, because $object is a node object instead of a user object.
Comment #4
fizk commentedThe output from theme('activity_username') is coming from theme_activity_username() in activity.module.
This function assumes that $object is a user object.
The comment for theme_username says that $object is usually returned from user_load().
Comment #5
Scott Reynolds commentedas discussed on IRC it isn't at all assuming a user object and neither is theme_username. It will not (not ever :-D) require a user object.
But for some reason for you it wasn't working and so it warrants more investigation. Not sure why it wasn't working, why the $node didn't have a name, but now I know that is is the following
a.) nodeapi : insert for custom content type (Kudos)
b.) the $object (in this case a node) doesn't have a $name
pretty strange, as I have used CCK nodes for messages just fine.
Comment #6
jtsnow commentedI think this may be a problem with the Token module, since activity templates use tokens. See #698242: User name tokens should use theme('username').
Comment #7
Scott Reynolds commentedre #6, activity provides a token for this. That issue will be marked as 'by design'.
Activity provides a number of tokens, for the node author we provide activity-creator-link (i think its called), which uses a special theme('username') implementation for Activity2. If you are using that token and having this problem please post here with description of whats happening including what your template is setup for and what you expected to happen vs. what did happen.
Comment #8
Scott Reynolds commentedBy design, it works just fine the way it is and its done on purpose.
Comment #9
Scott Reynolds commentedstrange issue with the project queue...