PDA

View Full Version : How to make a url based on Username?


yotsume
07-10-2014, 08:11 PM
QUESTION: How can I code a link to an external file such as a pdf where the member's username becomes part of the url so each link is unique to that user based on who is logged in. So when a user clicks the link they can download their file based on their username. When a different member is logged in they are taken to their file because the url will reflect their username instead...

Example: www.mydomain.com/files/username.pdf

So the username portion of the url would be pulled from vbulletin.

darnoldy
07-10-2014, 09:44 PM
The variable you want is $bbuserinfo[username]

Put this into the template where you want the link to appear:
<a href=" www.mydomain.com/files/$bbuserinfo[username].pdf">Get File</a>

Zachery
07-10-2014, 10:08 PM
You can go one further

$vboptions[bburl]/files/$bbuserinfo[username].pdf

In the future, should your url change, you wont have to update this again.

yotsume
07-10-2014, 10:11 PM
Okay I will try to work this out. I need to link a graphic with this kind of url...

Thanks for the help so far!