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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2004, 01:21 AM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What is wrong with this query?

I'm trying to custom write a user title color hack and I almost got it... However when the page loads online and I update the settings for some reason it's not making changes to the database row in the user table which is called titlecolor.

// ############################### Edit Title Color ###############################

if ($_REQUEST['do'] == 'edittitlecolor')
{
$templatename = 'titlecolor';
}

// ############################### Update Title Color ###############################

if ($_POST['do'] == 'updatetitlecolor')
{
globalize($_POST, array('titlecolor' => STR));

// Support tags HTML grog6
$titlecolor = strip_tags($titlecolor);


$DB_site->query("
UPDATE " . TABLE_PREFIX . "user SET
titlecolor = '" . addslashes($titlecolor) ."'
WHERE userid = $bbuserinfo[userid]
");

echo "titlecolor";

$url = "usercp.php?$session[sessionurl]";
eval(print_standard_redirect('redirect_updatethank s'));

}
Reply With Quote
  #2  
Old 08-10-2004, 04:14 AM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good question...

do you have global.php required?
And do you make sure somewhere, that the user is logged in? (not that $bbuserinfo[userid] is empty)
are you getting any error messages anywhere?
Reply With Quote
  #3  
Old 08-10-2004, 04:32 AM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

add echo statements to see if it's actually getting the variable. (I notice you're missing the $ in your echo statement)

Other than that the code looks fine, so I would say it's on the html form side of the script.
Reply With Quote
  #4  
Old 08-10-2004, 03:39 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Script's going through and I just used that echo statement as an example. I edited a row on my user in phpmyadmin and like changed the "titlecolor" to silver... went online on the page it was there and it showed silver, I then changed it to white and clicked save and then it went back to being blank where $usertitle should of been. So for some reason it's not saving through the database as text *shrugs*
Reply With Quote
  #5  
Old 08-10-2004, 04:16 PM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$titlecolor is probably not being set.

post the html of your form that submits to script, the problem is probably in there.
Reply With Quote
  #6  
Old 08-10-2004, 04:17 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you format you code with tabs to make it a little easier for us to read ?
Reply With Quote
  #7  
Old 08-10-2004, 11:14 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay here's the complete non working script.

Under the template definitions at the top of profile.php I have added this...

Quote:
'edittitlecolor' => array(
'titlecolor',
),
Then I have what I listed at the top of this page...

And to finish it off I have this template...

Quote:
<form action="profile.php" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="updatetitlecolor" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td>

<fieldset class="fieldset">
<legend>Update User Title Color</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td><smallfont>Enter the color of what you would like your User Title Color to appear on posts.</smallfont>
<div>
<textarea name=font rows=1 cols=30>$bbuserinfo[titlecolor]</textarea>
</div> </td>
</tr>
</table>
</fieldset>

</td>
</tr>
<tr>
<td>


<div style="margin-top:$stylevar[cellpadding]px">
<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
</div>
</td>
</tr>
</table>

</form>
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 02:06 AM.


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.04097 seconds
  • Memory Usage 2,228KB
  • 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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete