Jump to content

Recommended Posts

I am having trouble figuring this out myself, so hopefully someone can help me out.

 

What I am trying to do is write a code to link an image to a logged in users "edit profile" page. Right now, the page address the image needs to be linked to would be: "MyCollegeFleaMarket.com/users/Username"

 

Currently, the code I have in place is this: "users/<?php global $user; if ($user->uid) { print $user->name; } ?>"> but this is creating a link to, "MyCollegeFleaMarket.com/content/users/Username.

 

Thanks for your help!

 

 

Link to comment
https://forums.phpfreaks.com/topic/255680-code-request-link-to-users-profile/
Share on other sites

Althought I do shutter at doing a global inline with the code like you did, this should fix it:

 

"/users/<?php global $user; if ($user->uid) { print $user->name; } ?>">

 

The problem was that without the initial slash, it becomes relative to the page you are on, and thus the content is added. With the initial slash added it will be relative to the root.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.