By goldschmidt.a on
Hi all,
I'd like to put an item in a custom menu that links directly to the user's recent posts (directly to "my recent posts" rather than to "recent posts" first). Is there a way to automatically call the user's uid number and embed it directly in a URL? I'd imagine it would have a URL something similar to: http://www.X_DOMAIN_X.com/tracker/[$user]
Any ideas?
I'm using:
Drupal 6.1
MySQL 4.1.22
PHP 5.1.4
Thanks!
Andrew G
Comments
=-=
use the token module and the pathauto.module and you can then use: users/[user-raw]/track
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
add tokens in a menu?
Thanks for the incredibly quick reply. The Pathauto module has definitely helped my site a lot! I successfully did a Bulk generate for any user-tracker URLs that hadn't been aliased.
I've been able to create customized links within any new posts using the Token replacements, but I haven't been able to add a link to my Navigation Menu with Token replacements to part of a URL ([user-id], [uid], [user-name], or [user-raw]). I'm using Administer --> Site Building --> Menus and there doesn't seem to be a way to add automatic input from the Token module into the Path field.
I get an error either way:
The path 'user/[uid]/track' is either invalid or you do not have access to it.
or:
The path 'users/[user-raw]/track' is either invalid or you do not have access to it.
I looked around and found a thread talking about including the Token replacement for customized menus in core for D7, so maybe it's not available to embed Token references in menu links?:
http://drupal.org/node/113614
Just want to have a "my recent posts" link always visible on every page to authenticated users. Any ideas for a workaround?
figured it out! custom link module!
Okay, figured it out - - apparently, when you create a custom link using the Custom Link module, you can add Token substitutions (like [user-id], etc.) as long as you also have the Token module. Then, when you create your custom link, you can choose to have it display "In a sidebar block". Be sure to go to Site Building --> Blocks to enable the block. It is by default disabled! It is called "Custom node links". You can then put this block of links in the header, content, left sidebar, right sidebar, or footer areas! There's the solution for creating a link to "my recent posts," "my blog," "my profile," etc. on EVERY page that has any kind of a post (pretty much any page except the admin panels).
*sigh* So, you can't add custom Token replacements to a Menu or even to a Nice Menu, but you can through using Custom Link module!
Sincerely,
Andrew G
Came across a similar issue.
Came across a similar issue. One simple way to integrate it into your default menu would be to write a small custom forwarding module, that forwards from say "profile" to "something/$uid":
Code below did the trick for me:
For all future googlers:
For all future googlers: http://drupal.org/project/menu_token
Beautiful and simple module that does the trick with no muss, no fuss
i am the future googlers
i am the future googlers, and thank you for saving my time and life for sharing your experience.
^
For Googlers who want a small module to get just user ID to this function, try Me Alias module
What's new and changing in PHP 8.4