I see menu item My Blog points to the blog of the user (blog/(user no)).

so what is the variable to specify the user no?

Thx.

Comments

arhip’s picture

Use $user->uid

global $user;

print $user->uid;
sisyphus’s picture

I would like to add the value to the Path of add item screen of menu. what should I put after "blog/ "?

thx.

halloffame’s picture

I also need to know what variables are available to use in menu items? $user->uid does not seem to work.

Since menu items are all URLs I was kinda hoping that the variables for pathauto will ought to work so I included those variables in my menu links. As it turns out it does not work at all. I'm constructing a menu and I need the variables for 'edit profile' [user/%username/edit], 'my blog'[blog/%username], 'my profile' (I know I could just use 'user' and it will lead to mysite.com/user. But it would be nice if it could be mysite.com/user/username), 'track'[user/%username/track] , 'my contenttype'[contenttype/%username] and some other stuff. How are we going to implement variables in our menu url?

xcorex’s picture

There are so many users asking for this issue. May someone give us some light?

Thank you.

Winters-1’s picture

I accomplish this by making a block and then manually building the menu with html/php

xcorex’s picture

how?

Winters-1’s picture

I do it like this, but YMMV

<li class="leaf"><a href="/users/<?php global $user; print $user->name; ?>">My Account</a></li>
markfullmer’s picture

As I understand it, the original poster wants to create a hyperlink so that each user is directed to his/her personal blog, account, forum, etc.

I don't know how to do this in the menu (because the menu won't recognize php) but here's how to do it by creating a hyperlink

If you want to create a link to the user's account:
<a href="/user/<?php print $userid; ?>">My Account</a>

If, say, you want to create a link to the blog, this is the code:
<a href="/user/blog<?php print $userid; ?>">My Blog</a>

You can also stick the php code in the middle:
<a href="/user/<?php print $userid; ?>/myresults">My Quiz Results</a>

If you really want to put this into the menu, you may have to go into page.tpl or something and add it manually.

Also read:
http://drupal.org/node/38150

xcorex’s picture

with this code:

<a href="/user/<?php global $user; print $user->uid; ?>/track">Minhas participações</a>

But, how to put it into the "Navigation" Block?

Apollo610’s picture

Ok, I just to make sure I understand... there's no way to pass a variable into menu navigation?

IE, if I wanted to put a profile option in the menubar using the menu module (drupal 6), I can't point to /user/%username? (I know this syntax doesn't work b/c I've tried it with a bunch of others). This doesn't sound right...? But I couldn't find anything in the forums that explain how to do it.