TinyPortal

General => Chit chat => Topic started by: Jpg on August 22, 2006, 11:46:23 PM

Title: A little coding help.
Post by: Jpg on August 22, 2006, 11:46:23 PM
Well I need help with coding and it seems people will get mad if I pm them...lol... well here's my question...[Hard to explain]

I need a function to change a link using the user's #.
"U=[Users Number]"

Such as...

http://tinyportal.co.uk/smf/index.php?action=profile;u=1 <-this number.

But I want it so the member that clicks the link to go to theirs.

It's pretty hard to explain. :\

Thank you in advance.
Title: Re: A little coding help.
Post by: JPDeni on August 23, 2006, 12:56:53 AM
Where is this going to go? In a phpbox? And, basically, what you want is to make a link so that the user can access his or her own profile.

Anyway, what you want is the variable $ID_MEMBER, and you have to set it as global. To print a link to the user's profile, use

global $scripturl, $ID_MEMBER;
echo '<a href="' . $scripturl . '?action=profile;u=' . $ID_MEMBER . '">Profile</a>';
Title: Re: A little coding help.
Post by: Jpg on August 23, 2006, 01:36:54 AM
Ok thank you. I wasn't gonna use it for the profile but you just showd me how to do what I'm gonna do.
BTW Is there any list of variables to help people in their coding?
Title: Re: A little coding help.
Post by: JPDeni on August 23, 2006, 01:38:53 AM
I wish there was. When I run across something that I need, I start doing a search in the files. I'm starting to keep a list of them for myself. When I have enough collected to be of any use, I'll post it.
Title: Re: A little coding help.
Post by: Jpg on August 23, 2006, 01:52:56 AM
Cool. I can't wait.
Can't you post them now and then people can post more. Start making a list. ;)
Title: Re: A little coding help.
Post by: JPDeni on August 23, 2006, 02:54:28 AM
I'll make something that someone other than me can read. I use my own little shorthand that no one else would be able to understand.