By jantico on
Please help with the code to redirect to logged in user. I have a block with the following link: <a href="user/*" title="iuser">. This link works to show the block on a page but not as link. have also tried <a href="user/%" title="iuser">.
Would like the variable link to go to pages such as: /users/sponsorone or /users/adam or /users/ben if the users are logged in as sponsorone or adam or ben.
Thanks
John
[Edited to add code tags: nevets]
Comments
Using html
Using html you would use something like
this relies on using a text filter that allows the 'a' tag, by default this would be the full html filter.
If you use PHP code you can use
This approach requires the PHP code filter.
=-=
user/* doesn't work as a link because it's not a correct path with the * in there.
should be enough in most cases. however if you are in a block you may want to use an absolute url rather than a relative so that you don't have to deal with issues that arise if you are multiple levels deep. ie: yoursite.com/somenode/sometitle. The above should work because drupal is smart enough to know that any call to the user path from a logged in user will take that user to their own user page and dynamically add the uid
or generating a menu (which will generate the block) and adding your link that way should also work.
href="/user
Sorry, but neither are working. I tried:


or
The code is in a block in Drupal 6.
=-=
you cannot upload images to drupal.org. You must upload to a photosharing site.
<a href="user" title="iuser">
Tried all these as links in a block and returned page not found.
Thanks
John
Do you get any error when
Do you get any error when going to www.mysite.com/user when typed directly into the address bar?
If you can get to the user page OK, what appears in the status bar when you hover over the links in the block?
You can define, global
You can define,
global $base_url;
and make the url somehow like below :
echo $base_url .'/'.'user';
Hope it helps.
Abhishek Sawant
Drupal Developer