vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How do I load custome addon settings (https://vborg.vbsupport.ru/showthread.php?t=159321)

jim6763nva 10-02-2007 09:08 PM

How do I load custome addon settings
 
Hi everyone,

This is again in regard to the World of Warcraft Lottery addon I'm working on. I have a custom settings page similar to other addon settings pages that gives the admin the ability to enable or disable the addon for maintenance purposes, as well as set other global addon settings. I've done some research on how to load setting values from the database by looking at other addon code and searched the forums here. I've seen it done several ways to sunday, but now I'm totally confused and frustrated.
Would anyone has some simple suggestions/example on how to do this?

Thank you in advance!
Jim

Analogpoint 10-03-2007 12:29 AM

All settings are automatically loaded into the array $vbulletin->options by the vb core. Just use $vbulletin->options['your_setting_name'] to get the value.

Dismounted 10-03-2007 05:29 AM

And in templates, you can use $vboptions.

jim6763nva 10-03-2007 09:09 AM

I haven't put my settings in the vboptions though. I've created the following custom tables:
vb_lotteries
vb_lotterynumbers
vb_lotterysettings
vb_lotteryuserjoin


vb_lotterysettings fields
------------------------
name
value

this is so I can add more settings without altering the table structure.
Current settings include but are not limited to:

Name Value
HomeURL http://localhost/
lotteryactive 0
onoffreason "Lottery System is unavailable right now - please come back later"
Title "Test World of Warcraft Lottery System"

vb_lotteries fields
---------------------------
lotteryid
drawdate
ticketcost
jackpot

vb_lotterynumbers fields
---------------------------------
userid
ball1
ball2
ball3
ball4
ball5
ball6

vb_lotteryuserjoin fields
---------------------------------
userid
drawdate
confirm

Does this seem like the right way to go? Isn't there a more simple way of loading settings instead of using vboptions? This method seems a bit complex at my current stage of developing mods. :)

Thank you again for your input,
Jim

Analogpoint 10-03-2007 01:15 PM

All those setting could go in vB's settings table and you'd save yourself a lot of trouble, and your pages won't have so many queries. For stuff like home url, don't create a new setting, use vB's 'bburl' setting.

jim6763nva 10-03-2007 02:27 PM

1 Attachment(s)
Ok, I think I have the default settings worked out. Thank you all for your help! :)

In case you're interested in seeing what I have so far, I've included a screen shot:

Jim


All times are GMT. The time now is 04:47 PM.

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.01161 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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