PDA

View Full Version : Need help with $_GET['ting'] a parameter value to show in a template


Red Matrix
10-16-2012, 10:59 AM
I have tried searching the forum to no avail, words are too common.

In the register.php page, I am passing info to it via the GET parameter. I need to be able to look for the GET key in the URL, and then display its value in a field, to pre-populate it.

Currently the template has {vb:raw username} and it looks for the GET key called name, however I want that field to prepop with the value of a different key: custom%20user.

Can someone point me in the right direction please?


Thanks.

Dave

EDIT: Here is an actual example with fake data
/register.php?do=step2&email=someone%40gmail.com&from=someone%40gmail.com&custom%20user=Terminator2&meta_adtracking=reg&meta_message=1&name=John%20Connor&unit=forumreg&add_url=http%3A%2F%2Fforum.url%2Fstartregister.php&add_notes=192.168.0.1

kh99
10-16-2012, 11:58 AM
I'm a little confused because you say that it currently looks for the key 'name' and I don't see that in the register.php code anywhere (I also don't see any do='step2'). But anyway, maybe something like this (using a plugin on hook register start):

$vbulletin->input->clean_gpc('r', 'username', TYPE_NOHTML);

if (empty($vbulletin->GPC['username']))
{
$vbulletin->input->clean_gpc('r', 'custom user', TYPE_NOHTML);
$vbulletin->GPC['username'] = $vbulletin->GPC['custom user'];
}


That way it'll use 'custom user' if it exists and there's no username already specified (if you want 'custom user' to always override the username, then remove the 'if' statement but leave both clean_cpc() calls).

Red Matrix
10-16-2012, 01:24 PM
kh99,

Thanks for the reply.

EDIT:
I think i found the problem. This is in the plugin code:

$username = htmlspecialchars_uni($vbulletin->GPC['name']);

:o

I was trying to fix it in the template itself, which doesn't parse php.