vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Create checkbox group at your hack's options (usergroup selection for example) (https://vborg.vbsupport.ru/showthread.php?t=187470)

FractalizeR 09-24-2008 11:06 AM

Quote:

Originally Posted by veenuisthebest (Post 1629125)
1. And in the option code I see "setting[$setting[varname]", does varname needs to be replaced by something ?

No, leave it as is. This is for VBulletin Debug mode.

Quote:

Originally Posted by veenuisthebest (Post 1629125)
2. How do I check for the checked options from the php page ? Like for boolean we do :-
PHP Code:

if($vbulletin->options['mysetting_enable']
{
        
enabled true;
}
else
{
        
enabled false;


How to achieve similar for checkbox ?

Your $vbulletin->options['my_setting_name'] will contain comma delimited list of checked options. explode it and use.

Quote:

Originally Posted by veenuisthebest (Post 1629125)
3. umm.. not sure what you mean by bitfield supported. See in admincp->Social Group Options and Album Options and Visitor Message options. They all have a setting of "Allowed BBCODES", their option code is set to bitfield:nocache|allowedbbcodesfull and it automatically outputs a set of checkboxes of bbcodes.
I did the same and it works but as in my 2nd ques, how do I check it ?

Thank you

This is VBulletin internal feature I never used.

veenuisthebest 09-26-2008 07:10 PM

Thanks for your replies.

Can you please tell me what to do after creating the plugin at admin_options_processing hook.

Is this correct ?

PHP Code:

if(explode(','$vbulletin->options['show_settings']))
{
        
$showchecked true;
}
else
{
        
$showchecked false;


What I want to achieve is quite simple but i am not able to figure it out.

See.. I am showing 3 radio buttons via template. Simple !

Now.. I have created 3 checkboxes (corresponding to radio buttons) so that whichever is checked THAT radio button would show. How do I achieve this ? What should I wrap around my radio button code in template so that the corresponding one shows only when it is allowed (checked in admincp).

Thank you

FractalizeR 09-29-2008 08:50 AM

PHP Code:

$radioboxesToShow explode(','$vbulletin->options['my_radioboxes_to_show']);
if(isset(
$radioboxesToShow['radio_1'])) {
   
$show['radio_1'] = true;


Something like this I think. Emded all your radios in templates surrounded by if condition="show[radio_1]"

veenuisthebest 09-30-2008 02:09 PM

oh i still can't get it to work. See this is all what I had done:-

1. I created a setting $vbulletin->options['vin_mysetting'], Free datatype, with the following option code:-

Code:

" . eval('$options="";
$fritems = array(
        "option1" => "First Radio",
        "option2" => "Second Radio",
        "option3" => "Third Radio",
);
foreach($fritems AS $fritem_id => $fritem_name)
{
        $options .= "\\t\\t<label for=\\"setting[$setting[varname]]$fritem_id\\" title=\\"item id: $fritem_id\\"><input type=\\"checkbox\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]][$fritem_id]\\" value=\\"$fritem_id\\"" . iif(strpos(",$setting[value],", ",$fritem_id,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name=&quot;setting[$setting[varname]]&quot;\\"") . " />$fritem_name</label><br />\\n";
}
return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" />

2. Then I created a hook at admin_options_processing with the following code:-

PHP Code:

if (is_array($settings['vin_mysetting']))
{
    
$settings['vin_mysetting'] = implode(','$settings['vin_mysetting']);


3. Then in my file.php I did this (taking just "option1" for now.) :-

PHP Code:

$radioboxesToShow explode(','$vbulletin->options['vin_mysetting']);
if(isset(
$radioboxesToShow['option1'])) {
   
$show['option1'] = true;


4. Then at atlast, in the associated template, I did this:-

HTML Code:

<if condition="$show['option1']">
        <input type="radio" name="radiotype" value="0"/>My First Radio<br />
</if>


It never shows up now, whether checked or unchecked !

Thank you

Bravo 11-03-2008 10:50 AM

Thanks for the info, Ive been in need of this type of info... now I just need to figure out how to create options in the UserGroup and User settings


All times are GMT. The time now is 12:39 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.03099 seconds
  • Memory Usage 1,744KB
  • 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
  • (1)bbcode_html_printable
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete