1

I created a blog site and I used the Display Suite module to create a layout for the article content type. In one of the regions I created a custom code field that had "Posted by [user:name] on [node:created:long]".

After creating it I noticed that only the date was showing up and not the user token. I tested this out with several of the user tokens and none of them seemed to work. The only thing I can think of is that users tokens aren't supposed to work in Display Suite, but I couldn't find any proof one way or another.

The second issue is involving the number of views to a particular node. When I go to drupal.org, there is a list of tokens. The one I am trying to use is [node:source:total-count], but nothing appears. I read that it might be a more in depth process than a simple token.

1

The token used to get the user who wrote the content is not [user:name]. This is the username of a user account that you are trying to view, so this might not be available on the node page as we are not referring a user.

To display the author name you should use [node:author:name].

If you install the token module you could go to the Help > Token (admin/help/token) page and see the available tokens.

For more details and a list of the available tokens, see this page.

EDITED As per suggestion in comment.

  • 2
    For tokens like [node:author:name], or [user:name] there isn't the need to install the Token module; those tokens are defined from Drupal. – kiamlaluno Jan 20 '13 at 10:17
  • thanks for the corrections. but to get the list of tokens from the Help > Token link you need to have tokens installed I guess. – Mohammed Shameem Jan 20 '13 at 10:19
  • I am referring to your first sentence. Most of the tokens are defined from Drupal 7, not the Token module. As the OP is trying to use the token returning the username of the node author, the Token module is not necessary. – kiamlaluno Jan 20 '13 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.