Closed (fixed)
Project:
Activity
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 May 2009 at 07:21 UTC
Updated:
23 May 2010 at 22:55 UTC
For record user activity I'm using global token [user-name] and [user-id]. My pattern for node view action is: <a href="/user/[user-id]">[user-name]</a> view a node '<a href="[node-url]">[title]</a>'. Its work great when user is authorized, but when anonymous user view node, I see broken link to /user/0. How can I avoid this? Is it possible to make additional token to user's profile page (with aliased support)?
Thanks for help.
Comments
Comment #1
sirkitree commentedIn the case of an anonymous user, the uid is always going to be 0 and there isn't much we can do about that. We could probably create a new token that would detect if the uid is 0 and not create a link, but just report the 'Anonymous' user name.
You'll have to provide your own tokens for create clean url links as well. It would be helpful to more people than just yourself, I'm sure, and we've provided a way to extend the core tokens. If you take a look inside of the /activity/modules/comment.activity.inc file, you will see that we are extending the comment tokens there by creating the functions called comment_activity_token_list() and comment_activity_token_values(). This could also be done within the skeleton node.activity.inc file. Here is where you could create a new token that would use the node object's uid property in order to create a clean link to the node author's profile page or, if the uid is 0, just return text which is gotten from the site's designated 'Anonymous' user name.
Comment #2
drewish commentedwhat about the [author-link] token?
Comment #3
sirkitree commentedPlease note that my above reply is incorrect and we are not providing an example to do this right now. It was taken out when we decided to provide the relevant node tokens because a comment is already associated with a node, so all of the node tokens are now available as well.
[author-uid/name/name-raw/mail/mail-raw] are available.
[author-link] could be created in /activity/modules/user.activity.inc
Comment #4
Scott Reynolds commentedI went ahead and committed a whole bunch of these.
activity-node-link - link to the node
actiivity-node-creator-link - link to the node creator
activity-comment-author-link - link to the author of the comment
activity-user-link - link to the user.
After doing all that I realized that perhaps using theme('username') isn't a good thing. The reason why its potentially bad, is because the base line drupal implementation does
That means that if the user doesn't have permission to access user profiles then it won't render a link. So perhaps we need our own overridable theme function?
I leave that task to a separate ticket #580766: Provide a theme function that is virtually equivlent to theme_username
Comment #6
sadist commentedhi scott.
i'm creating an activity template to record user comments. i used the token [activity-comment-author-link] and it recorded down but without Realname. i've been searching all over and the only issue created i got is this one.
the theme function that you posted here: http://drupal.org/node/580766 doesn't help at all. so is there anything else that i need to do?
cheers.
Comment #7
ee97083 commentedHi Scott!
This module is awesome but...I used [activity-node-creator-link] token for reporting when someone checked other person's Blog entry and the link is in fact created with the author's user name that created the entry but...the url points not to the profile of the node creator but to the profile of the user viewing the activity listing view!?! Why does it creates the text link well but not the url?
Can you help me please?
Regards
Comment #8
Scott Reynolds commentedHas to do with this change #699110: Record an activity message when: node update --> activity is displayed for the node author instead of the activity author. . Please open a new issue