I am trying to use a custom block with php to move the personal contact form link to the right sidebar. I've moved some other menu links to blocks using php. I've tried the following:

global $user;
echo '
<ul class="contactlink">
'.l("Contact $user->name", "user/$user->uid/contact", array('title' => 'My personal info')).'
</ul>';

This returns the logged in user's name. I don't really want to us a ul for this, it's just that's what I used for the other block to move a few menu items and I'm not that great at creating php. Would there be a way to use a token for the user being viewed (or user ID from url) and just include it inside an href in a div? I think this could be very useful as the contact link currently supplied is not very prominent.

Comments

CarbonPig’s picture

Same Question - Can you use tokens in node/block text?

Sinan Erdem’s picture

Can we?

MBroberg’s picture

With the Token module and Token Filter module I was able to use tokens in text areas. The format is [token user uid] or [token global user-name], etc, and there are more samples in the documentation.

francewhoa’s picture

Thanks MBroberg. Here is the direct link to Token Filter module: http://drupal.org/project/token_filter

Loving back your Drupal community result in multiple benefits for you