Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Store add-on - remove warning points - help needed! Details »»
Store add-on - remove warning points - help needed!
Version: , by X-Fan X-Fan is offline
Developer Last Online: Apr 2005 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-11-2003 Last Update: Never Installs: 0
 
No support by the author.

G'day all,

I tried modifying a few existing hacks to create an add-on for Lesane's store wherein a user could pay to have a warning point removed (from g-force2k2's Warning Hack), but I've hit a snag wherein the check to see if a user has any points and giving them an error screen if they don't isn't working.

Here's the code:

Code:
  $warns = $DB_site->query_first("SELECT warninglvl FROM user WHERE userid='$bbuserinfo[userid]'");
  if ($warns <= 0) {
    eval("standarderror(\"".gettemplate('store_removewarn_error')."\");");
  }
Any idea why that's not working?

Also, here's the code I've got for removing the point. Not sure if it works or not as I haven't got that far, but comments would be appreciated, thanks!

Code:
  if ($cost>$points) {
    eval("standarderror(\"".gettemplate('store_error')."\");");
  } else {
    $DB_site->query("UPDATE user SET warninglvl=warninglvl-1,storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
    $changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='removewarn'");
    $moneycheck = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
    $money = $moneycheck[storep];
    eval("dooutput(\"".gettemplate("store_removewarn_done")."\");");
  }
}

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 09-14-2003, 09:56 AM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$warns $DB_site->query_first("SELECT warninglvl FROM user WHERE userid=$bbuserinfo[userid]");
 
$warns1 $DB_site->fetch_array($warns);
 
if (
$warns1['warninglvl'] < or empty($warns1['warninglvl'])) {
 
eval(
"standarderror(\"".gettemplate('store_removewarn_error')."\");");
 

Reply With Quote
  #3  
Old 09-14-2003, 10:40 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks N9ne, it came up with the warn_error template, but I got this error at the top of the page:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in db_mysql.php on line 149
Reply With Quote
  #4  
Old 09-14-2003, 12:12 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What's line 149?
Reply With Quote
  #5  
Old 09-14-2003, 01:16 PM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
$this->record = mysql_fetch_array($this->query_id);


Reply With Quote
  #6  
Old 09-14-2003, 02:36 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

N9ne why are fetching the array again. Query first does all the hard work for you

Try this:

PHP Code:
$warns $DB_site->query_first("SELECT warninglvl FROM user WHERE userid=$bbuserinfo[userid]");

if (
$warns['warninglvl'] < or empty($warns1['warninglvl'])) {

eval(
"standarderror(\"".gettemplate('store_removewarn_error')."\");");


Reply With Quote
  #7  
Old 09-14-2003, 11:04 PM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool, that did it, thanks guys!

I'll write this up and post it in the Beta hacks forum, with thanks to you both, of course!
Reply With Quote
  #8  
Old 09-15-2003, 09:56 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your Welcome
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 10:21 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.04543 seconds
  • Memory Usage 2,274KB
  • Queries Executed 21 (?)
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
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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