vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding Settings to the AdminCP (https://vborg.vbsupport.ru/showthread.php?t=117315)

UltraVR 06-01-2006 01:57 PM

Adding Settings to the AdminCP
 
Hello,

I am working for an update to a product of mine, and I cannot figure out for the life of me how to add a setting to the AdminCP that is in the form of a dropdown menu. If anyone could please explain to me how this works, it'd be much appreciated.

For example, here is how to do it for a boolean setting:

PHP Code:

            <setting varname="bf_new_window" displayorder="10">
                <
datatype>boolean</datatype>
                <
optioncode>yesno</optioncode>
                <
defaultvalue>1</defaultvalue>
            </
setting

How would I create a dropdown menu to allow users to choose a certain setting, though?

Alan @ CIT 06-01-2006 07:06 PM

1 Attachment(s)
The easiest way is just to find a dropdown in the regular vBulletin options, click on "Edit" link next to it and copy the code :)

For example, the "Enable Forum Leaders" dropdown option in vB->Options has an option code of:

Code:

<select name=\"setting[$setting[varname]]\" tabindex=\"1\" class=\"bginput\">
<option value=\"0\" " . iif($setting['value']==0,'selected="selected"') . ">$vbphrase[no]</option>
<option value=\"1\" " . iif($setting['value']==1,'selected="selected"') . ">$vbphrase[yes]</option>
<option value=\"2\" " . iif($setting['value']==2,'selected="selected"') . ">$vbphrase[yes_but_disable_moderators]</option>
</select>

So essentially, you just have to write the <select> code yourself.

Thanks,
Alan.

UltraVR 06-02-2006 03:00 AM

Thanks! I got that part to work, but now I have another problem.

I have added this setting to my product:

PHP Code:

    <setting varname="bf_new_window" displayorder="10">
                <
datatype>boolean</datatype>
                <
optioncode>yesno</optioncode>
                <
defaultvalue>1</defaultvalue>
            </
setting

And in the actual code, I have this conditional:

PHP Code:

if ($vbulletin->options['bf_new_window'] == 1)
{
Case 
1
}
else
{
Case 
2


The problem is that the code always ends up skipping case 1 and going with case 2. Is there some other way to use a boolean setting in a conditional?

Alan @ CIT 06-02-2006 05:21 AM

That code should work fine. Are you using it within a function or class? If so, you might need to global $vbulletin.

Thanks,
Alan.

UltraVR 06-02-2006 05:47 AM

Yes, it is within a function. That would explain why a similar conditional I used works elsewhere in the code. How do you global $vbulletin?

Alan @ CIT 06-02-2006 05:57 AM

At the top of the function, put:

PHP Code:

global $vbulletin

This allows $vbulletin to be used within a function.

Thanks,
Alan.

UltraVR 06-02-2006 06:52 AM

A million thanks to you! It worked, and you are now my hero.

Thanks,
A fellow Alan. :)

Adult SEO 06-02-2006 12:08 PM

Hi!

I am trying to enable debug mode to be able to add settings via a vBulletin system. I added $debug=1; on top of the config.php file but I don't see any option to add settings.

Please help!

Kirk Y 06-02-2006 01:44 PM

Enabling debug mode changed from $debug=1. Use the following in your config.php file:
PHP Code:

$config['Misc']['debug'] = true



All times are GMT. The time now is 08:34 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.00988 seconds
  • Memory Usage 1,737KB
  • 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)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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