Tokens

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.

Welcome

The Token module for Drupal 4.7 and 5 exposes simple text substitution tokens like [title] and [user-name], for use in path generation, mass mailings, and many other situation where admins want to set up text replacement patterns without using PHP snippets. Other modules can expose their own domain-specific replacement tokens (like information about a purchase, or an organic group that a user is a member of) and use Token's centralized replace() function to replace token occurrences in any piece of text.

If you are curious how you might use tokens or who is using it, consider this list of modules that use token

If you want to help get Token into Core then there's the issue. Please don't just subscribe to the issue or you will lose karma points in the eyes of some of Drupal's most respected community members.

greggles's picture

new releases of token

It's about time for a new release, right?

If you are on of the people interested in this, please head on over to issues to fix before a 6.x-1.12 Release to help finalize the 2 remaining patches and suggest any issues that you'd like to see fixed prior to the release.

Read more
shushu's picture

user_pass_reset_url token

I am trying to use the CCK+Rules+Token module to accomplish creation of a user when a content with its email address is being created.
This user should get an email notification with his password and/or a user_pass_reset_url link.

The token_user.inc does not provide password, nor the creation of the user using the rules action.
In addition, the !password of the user_mail_tokens does not apply here.

Any suggestion what should be the right way to solve this ?

Regards,
Shushu

Read more
fago's picture

Tokens & RDF in d7 - can they benefit from each other?

Right now there is a issue for getting token into core and one for getting some RDF into it. I wonder if makes sense to base the token patch upon the RDF stuff. So once we have some semantics attached to our objects, we can use them as a starting point for doing the token replacements.

The other way round, the RDF patch could learn from the tokens code - as the actual problem to solve is quite similar. The way the patch in #74 uses simple handlers to get tokens would make sense for RDF too. Then the token implementation can go and build upon that and reuse the handlers returning RDF string literals. Similarly, the approach described in #77 for doing actual token replacements could also be used for getting chunks of RDF for a bunch of objects.

Then apart from avoiding inventing the wheel twice, we could easily make both APIs consistent, so they can be used the same way.

Read more
sirkitree's picture

Better token lists

Has anyone come up with a better way of presenting the list of tokens to users? I'm finding that what I'm doing is really ugly and would love to know if anyone has seen any good examples of how to present tokens in a more usable manner.
Only local images are allowed.

Read more
ausvalue@drupal.org's picture

Possible New Drupal Modules

Possible New Drupal Modules

I have a few ideas for Drupal modules. All are related to Social Networking Sites in that they are an attempt to allow nodes to appear as if they are part of each users account. The first and third modules are related to the Token module.

I'm anticipating developing these modules for Drupal 6 and later versions of Drupal. Not for Drupal 5. I've done some work towards the first module (Type user nids) but very little for the other two.

I'm asking the following:

1) Are these likely to be useful to the Drupal community?

Read more
flickerfly's picture

Using tokens in a menu link

Update by develCuy: Use the module http://drupal.org/project/menu_token

I have a menu item that I'd like to make different for each user. It's an internal page that accepts &_GET in the URL.

I'm thinking I could skip the user past entering this information in manually by providing the url like http://site.com/?user=loggedinuser&target=somepage. Could I fill this username with the drupal username using a token or are they just not available in the context of menu entries?

How else could I solve this if not with tokens?

Read more

New releases of Token module - Suggest issues and help test

Hi folks,

I think it's about time to do another relase of both the 6.x and 5.x branches of code. The last issue I'd like to fix is menu* generally broken which has a patch that needs review.

Anything else that should really really be fixed? Add it here:

And if you're using the latest 5/6.x-1.x-dev version of token and it's working for you it would be nice to hear that as well.

Read more
nikita-gdo's picture

Token for the email address of the author of the comment that someone replied to

Is there a token (or a way to create one) that can be used to notify the author of the comment (not of the node) that someone has replied to it?

Read more
laken's picture

Does module exist to let site editors maintain own tokens and replacement text?

I really love token module! I'm especially loving it in pathauto and auto nodetitles - very powerful.

Is there a module to permit site editors to create and maintain their own tokens and corresponding replacement text, either through a UI or in a text file?

The site I'm building needs to let editors store snippets of text which can be reused in many places. For instance we might have this in node content: "McDonalds has sold [num_bugers_sold] in their history". We'd need a way to edit the value for [num_bugers_sold] and have that token update wherever it's used.

Read more
cwarden@xerus.org's picture

tokens in node body

What's the proper way to replace tokens within a node body?
I've created a simple module that implements hook_token_values and
hook_token_list, but to use my token within a node body, I've had to
implement hook_nodeapi, which doesn't seem right.

<?php
function mymodule_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
   if (
$op == 'alter') {
     
$node->body = token_replace($node->body);
   }
}
?>

How about within a template? Is this discouraged?

<?= token_replace('[my-token]') ?>
Read more
Subscribe with RSS Syndicate content

Tokens

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: