views:

40

answers:

1

How do I get a user's profile path in Drupal based on the author of the current node?

<?php print t('Posted on !date by !username', array('!username' => theme('username', $node), '!date' => format_date($node->created,'custom','m.d.y'))); ?>

The above gets me the right url, but that's all i want... the url.

+1  A: 

$link = drupal_get_path_alias('user/' . $node->uid);

At least I think that's the most direct. I'm sure there's a more correct answer though.

Chuck Vose
Also, I think in your theme templates $author is available directly.
Chuck Vose
i wasn't able to get the author var but, get_path_alias was exactly what i was looking for thank you!
matt ryan
Awesome, glad it helped :)
Chuck Vose
If you're using this to link to the user page (the common use case), you can skip drupal_get_path_alias and just pass the user/# path to l (http://api.drupal.org/api/function/l/6), which will convert it to the alias for you.
Scott Reynen