No need to specify 'global' => NULL. Global tokens are automatically replaced.
No need to specify 'user' => global $user. Users should be using the [current-user:*] tokens.

CommentFileSizeAuthor
#1 1017384-ga-token-replace-cleanup.patch1005 bytesdave reid

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new1005 bytes
hass’s picture

Status: Needs review » Fixed

THX for review.

hass’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Fixed » Patch (to be ported)

I keep this open for D6 backport in #609892: Multiple custom variables.

hass’s picture

@dave: Can you give me a hint for D6, please?

Is this line of code correct?

$custom_var_value = token_replace_multiple($custom_var_value, array('global' => NULL, 'user' => $user, 'node' => $node));

How can we clear tokens that haven't been replaced? They seems to be kept in the string as configured? D7 have the array('clear' => TRUE), but I cannot find this for D6.

dave reid’s picture

The latest development code actually supports using $options['clear'] with token_replace or token_replace_multiple(). Use:

token_replace_multiple($custom_var_value, array('global' => NULL, 'user' => $user, 'node' => $node), '[', ']', array('clear' => TRUE));
hass’s picture

Great, thank you very much!

hass’s picture

Status: Patch (to be ported) » Fixed

I set this fixed now as it will go in with the first commit of #609892: Multiple custom variables

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.