Username Vs User ID on memberlist_view/profile

Discussion forum for MOD Writers regarding MOD Development.
User avatar
RaythXC
Registered User
Posts: 150
Joined: Wed Jun 13, 2012 1:23 pm

Re: Username Vs User ID on memberlist_view/profile

Post by RaythXC » Thu Dec 11, 2014 4:40 pm

I find it hard that no one's mentioned this.. but since you have to be getting username from the database to generate the link, find the part that has 'USERNAME' => <soemthing> (this is where the template variable is beign set) and for the something do it like this:

urlencode(<something>)

PHP Manual: http://php.net/manual/en/function.urlencode.php

User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Username Vs User ID on memberlist_view/profile

Post by Oyabun1 » Sat Dec 13, 2014 8:25 am

RaythXC wrote:I find it hard that no one's mentioned this.. but since you have to be getting username from the database to generate the link, find the part that has 'USERNAME' => <soemthing> (this is where the template variable is beign set) and for the something do it like this:

urlencode(<something>)

PHP Manual: http://php.net/manual/en/function.urlencode.php
Why do that rather than using username_clean as Rich suggested earlier?
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

User avatar
RaythXC
Registered User
Posts: 150
Joined: Wed Jun 13, 2012 1:23 pm

Re: Username Vs User ID on memberlist_view/profile

Post by RaythXC » Sun Dec 14, 2014 1:37 pm

Oyabun1 wrote:Why do that rather than using username_clean as Rich suggested earlier?
Honestly? I've never actually looked at the username_clean column. None of the forums i've had access to have had spaces in usernames so never noticed what it looked like. As a php coder I'm used to php functions such as urlencode() to put something with spaces in an url, then using urldecode() to get the correct value again.

Locked

Return to “[3.0.x] MOD Writers Discussion”