Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 10-16-2012, 10:59 AM
Red Matrix Red Matrix is offline
 
Join Date: Jun 2006
Location: Texas
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 10-16-2012, 11:58 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 10-16-2012, 01:24 PM
Red Matrix Red Matrix is offline
 
Join Date: Jun 2006
Location: Texas
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']); 


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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03391 seconds
  • Memory Usage 2,172KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete