Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 03-02-2011, 09:08 PM
kvnband kvnband is offline
 
Join Date: Feb 2004
Location: AR
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, that is exactly what I'm talking about. I have already implemented the bitfields (That part is incredibly easy, actually) but I don't know how to check them on the front-end. Hopefully someone can chime in.
Reply With Quote
  #12  
Old 03-04-2011, 12:18 AM
kvnband kvnband is offline
 
Join Date: Feb 2004
Location: AR
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, I've made some progress. I thought I was doing good, until I went to create an update form. Does vBulletin have some sort of special trickery regarding $_POST? I have a basic update form that posts back to itself. But no matter what I do, I cannot get the dang thing to do anything. When I hit submit, I just get a blank page. Getting frustrated here...

Here is my PHP:

PHP Code:
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT''voting_booth');
define('CSRF_PROTECTION'false);  
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('tsgvotingbooth',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

require_once(
'./global.php');

/****************************************
Define usergroups.  Will move to admincp eventually
****************************************/
$ug_voting_members=17;



/*****************************************
If the user is not logged in, kill it here
*****************************************/
//if(!isset($bbuserinfo['userid'])) {
//    print_no_permission();
//}

/*****************************************
List Elections
*****************************************/
if($_SERVER['REQUEST_METHOD']=='GET' && (!isset($_GET['do']) || $_GET['do'] == '')) {

}


/****************************************
Show registration form
****************************************/
else if($_SERVER['REQUEST_METHOD'] == 'GET' && $_GET['do'] == 'register') {
//print_r(get_defined_vars());
    
$navbits construct_navbits(array('' => 'Voting Booth Registration'));
    
$navbar render_navbar_template($navbits);
    
$pagetitle 'Voting Booth Registration';
    
    
$templater vB_Template::create('tsgvb_register_form');
    
$templater->register_page_templates();
    
$templater->register('navbar'$navbar);
    
$templater->register('pagetitle'$pagetitle);
    
$templater->register('ug_voting_members'$ug_voting_members);
    
print_output($templater->render());
}

else if(
$_SREVER['REQUEST_METHOD'] == 'POST' && $_POST['do'] == 'register') {
print_r($_POST);
}

?>
Here is my form template:
PHP Code:
{vb:stylevar htmldoctype}
<
html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <
head>
    <
title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
    {
vb:raw headinclude}
    {
vb:raw headinclude_bottom}
  </
head>
  <
body>
    
    {
vb:raw header}
    
    {
vb:raw navbar}
    
    <
div id="pagetitle">
      <
h1>{vb:raw pagetitle}</h1>
<
class="description">In order to vote in electionsyou must be registered.  Please fill out the following form to become a registered voter or to update your information.</p>

    </
div>
    
    <
h2 class="blockhead">Registration Form</h2>
    <
div class="blockbody formcontrols settings_form_border">
        <
fieldset class="blockrow">
            <
form action="voting_booth.php" method="post">
            <
input type="hidden" name="do" value="register" />
                <
legend>Registration Information</legend>
                <
ul class="group">
                    <
li>
                        <
label for="first_name">First Name: </label>
                        <
input type="text" name="first_name" id="first_name" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field5}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="last_name">Last Name: </label>
                        <
input type="text" name="last_name" id="last_name" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field6}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="phone">Phone Number: </label>
                        <
input type="text" name="phone" id="phone" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field7}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="street">Street Address: </label>
                        <
input type="text" name="street" id="street" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field8}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="city">City: </label>
                        <
input type="text" name="city" id="city" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field9}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="state">State: </label>
                        <
input type="text" size="2" name="state" id="state" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field10}"</vb:if> />
                    </
li>
                    <
li>
                        <
label for="zip">Zip Code: </label>
                        <
input type="text" name="zip" id="zip" <vb:if condition="is_member_of($bbuserinfo$ug_voting_members)">value="{vb:raw bbuserinfo.field11}"</vb:if> />
                    </
li>
                    <
li>
                        <
input type="submit" name="submit" value="Submit Registration Information" />
                    </
li>
                </
ul>
            </
form>
        </
fieldset>
      </
div>
    </
div>
    
    {
vb:raw footer}
  </
body>
</
html
The form loads up and looks fine, and is prefilled with the user's data, if it is available (I realize that this code is not exactly right, but it's working for now). But when I hit submit, I get a blank page, even though I have coded for it in the PHP file.

Obviously I'm missing something important here.

Any advice is appreciated.

--------------- Added [DATE]1299205201[/DATE] at [TIME]1299205201[/TIME] ---------------

Edit - Wow. I looked at this code for 20 minutes and couldn't figure out my problem. Posted here and almost instantly realized that I wrote $_SREVER instead of $_SERVER......

I'm leaving it here as a learning experience for others.
Reply With Quote
  #13  
Old 03-04-2011, 12:43 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Spell check is your friend.
Reply With Quote
  #14  
Old 03-04-2011, 12:51 AM
kvnband kvnband is offline
 
Join Date: Feb 2004
Location: AR
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I normally would catch an issue like that. But since this is all going on inside of VB, I'm quick to think I've messed something up inside there.

This really isn't all that hard so far. Just have to remember what variables I can access and it's pretty breezy.
Reply With Quote
Reply


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 11:53 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.04319 seconds
  • Memory Usage 2,259KB
  • Queries Executed 13 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete