vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Need help with $_GET['ting'] a parameter value to show in a template (https://vborg.vbsupport.ru/showthread.php?t=289129)

Red Matrix 10-16-2012 10:59 AM

Need help with $_GET['ting'] a parameter value to show in a template
 
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
Code:

/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):

Code:

$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:

PHP Code:

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

:o

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


All times are GMT. The time now is 09:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01527 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete