vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-to] Add a multiselect field in vBulletin options (https://vborg.vbsupport.ru/showthread.php?t=191666)

ozzy47 10-09-2013 12:26 AM

Ok here is how I do a forum chooser.

First create the option, and in the field, Option Code add the following:
Code:

"; $forums = array(0 => $vbphrase['none']);
if (is_array($vbulletin->forumcache))
{
  foreach($vbulletin->forumcache AS $forumid => $forum)
  {
  $forums["$forum[forumid]"] = construct_depth_mark($forum['depth'], '--') . ' ' . $forum['title'];
  }
}
$right = "<select name=\"setting[$setting[varname]][]\" id=\"".$setting[varname]."\" tabindex=\"1\" class=\"bginput\" size=\"20\" style=\"width:300px;\" multiple=\"multiple\">\n";
$right .= construct_select_options($forums, explode(',',$vbulletin->options[$setting[varname]]), false);
$right .= "</select>\n"; $null = "

Then you will need to do the plugin for admin_options_processing
Code:

    $setforums = 'VARNAME FOR YOUR SETTING';
    if ($oldsetting['varname'] == $setforums)
    {
      if (in_array(0, $settings[$setforums]))
      {
          $settings[$setforums] = '0';
      }
      else
      {
          $settings[$setforums] = implode(',',$settings[$setforums]);
      }
    }
    $setforums = '';

Then you can use the code I provided earlier.

Simon Lloyd 10-09-2013 12:35 AM

Lol, thanks, did you see my note? :)

ozzy47 10-09-2013 12:37 AM

Not until well after I had replied. :)

Easy5s.net 06-20-2015 09:45 AM

Quote:

Originally Posted by ozzy47 (Post 2451071)
Ok here is how I do a forum chooser.

First create the option, and in the field, Option Code add the following:
Code:

"; $forums = array(0 => $vbphrase['none']);
if (is_array($vbulletin->forumcache))
{
  foreach($vbulletin->forumcache AS $forumid => $forum)
  {
  $forums["$forum[forumid]"] = construct_depth_mark($forum['depth'], '--') . ' ' . $forum['title'];
  }
}
$right = "<select name=\"setting[$setting[varname]][]\" id=\"".$setting[varname]."\" tabindex=\"1\" class=\"bginput\" size=\"20\" style=\"width:300px;\" multiple=\"multiple\">\n";
$right .= construct_select_options($forums, explode(',',$vbulletin->options[$setting[varname]]), false);
$right .= "</select>\n"; $null = "

Then you will need to do the plugin for admin_options_processing
Code:

    $setforums = 'VARNAME FOR YOUR SETTING';
    if ($oldsetting['varname'] == $setforums)
    {
      if (in_array(0, $settings[$setforums]))
      {
          $settings[$setforums] = '0';
      }
      else
      {
          $settings[$setforums] = implode(',',$settings[$setforums]);
      }
    }
    $setforums = '';

Then you can use the code I provided earlier.



Code:

    $setforums = 'check_forums';
    if ($oldsetting['varname'] == $setforums)
    {
      if (in_array(0, $settings[$setforums]))
      {
          $settings[$setforums] = '0';
      }
      else
      {
          $settings[$setforums] = implode(',',$settings[$setforums]);
      }
    }
    $setforums = '';

i user hook newthread_start with code

Code:

        if (in_array($foruminfo['forumid'], explode(',', $vbulletin->options['check_forums'])))
        {
                if ($vbulletin->userinfo['dola'] < $vbulletin->options['newthread_dola'])
                {
                        eval(standard_error(fetch_error('no_dola')));
                }
        }

but not work :confused:


All times are GMT. The time now is 02:38 PM.

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.01188 seconds
  • Memory Usage 1,725KB
  • 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
  • (6)bbcode_code_printable
  • (1)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
  • (4)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