Closed (outdated)
Project:
Link
Version:
7.x-1.0-alpha3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Mar 2011 at 11:02 UTC
Updated:
31 Aug 2024 at 10:55 UTC
Jump to comment: Most recent
When adding a link field to user profiles and using user tokens (e.g. [user:name]) to the link title, the tokens are not replaced.
I was able to get the tokens replaced by replacing:
$item['url'] = token_replace($item['url'], array('node' => $token_node));
With:
$token_user = !isset($node->nid) && isset($node->uid) ? user_load($node->uid) : NULL;
$item['url'] = token_replace($item['url'], array('node' => $token_node, 'user' => $token_user));And replacing:
$title = filter_xss(token_replace($title, array('node' => $token_node)),
array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u'));With:
$token_user = !isset($node->nid) && isset($node->uid) ? user_load($node->uid) : NULL;
$title = filter_xss(token_replace($title, array('node' => $token_node, 'user' => $token_user)),
array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u'));Hopefully I am using the correct way to detect if you are viewing a node or a profile.
Comments
Comment #1
dqdI'll close this issue due to inactivity for 12 years and upcoming EOL of Drupal 7 in January 2025. While the project version for Drupal 7 will keep providing support for security issues and website breaking bug fixes for Drupal 7, we should try to minimize the open issues for Drupal 7 in the queue as much as possible. Thanks for the report and all the efforts in here. Feel free to re-open if you can provide a fix or found an additional related problem which increases the issue priority to "Critical" here.