Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[How-to] Add a multiselect field in vBulletin options
Coroner
Join Date: Feb 2008
Posts: 797

I start for about 25 years with an TI and learned Basic. Next was an Commodere 64, Amiga. On Amiga I learned Assembler and wrote some Games. Many years later again, I learned myself (without book ...) php,html and javascript. Then I wrote some small

Germany
by Coroner Coroner is offline 23 Sep 2008

I wrote this article 'cause I didn't found anything else but it was needed for mod I wrote.

Before I start - will have to say this is an example for a forumchooser.

In our product under options, create an option like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I'll use: multiselect:eval.

Ok, we finished our first part and need 2 new plugins.

The first plugin we used is admin_options_print.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

See the code above and take a look at this three lines:
$array = construct_forum_chooser_options (0);
$selected = explode (',', $setting['value']);
$name .= "[]";
The 1st line are our options array, filled with information coming from the function "construct_forum_chooser_options(0)". If you wanna have your own, create an array with your options.
2nd line: our value (saved later in the options will implode by a comma like: 5,8,11,26,.. we need to explode this value to get the selected values back.
3rd line: this is needed for multiselect

The next plugin is called: admin_options_processing.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This plugin will implode our selected values with a comma.

Regards
Views: 6459
Reply With Quote
Comments
  #2  
Old 10 Oct 2008, 17:38
Stoebi Stoebi is offline
 
Join Date: Apr 2006
Real name: Peter
This is great. Thank you very much for sharing


Regards,

Stoebi
Reply With Quote
  #3  
Old 28 Oct 2008, 14:52
Blackhat's Avatar
Blackhat Blackhat is offline
 
Join Date: Mar 2005
can this be used in the user cp > options to make a "forum chooser" and which hook should I use?
__________________
running vBulletin 4.0.6
Reply With Quote
  #4  
Old 24 Nov 2008, 09:31
ReCom ReCom is offline
 
Join Date: Mar 2008
A setting with datatype "bitfield" can create a group of checkboxes (multiselection) in vBulletin Options.
Reply With Quote
  #5  
Old 18 Jul 2009, 09:14
Coroner Coroner is offline
 
Join Date: Feb 2008
Real name: Stefan
I didn't mean a forumchooser (Selectrow) or a multiple checkbox.

See image for the "multiselect field" what I mean.
Attached Images
File Type: jpg Bild 1.jpg (34.1 KB, 156 views)
Reply With Quote
  #6  
Old 09 Oct 2013, 01:07
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
The chooser code is great but i am unsure how to call it in a plug in, normally i'd have the user enter the forum id's and use something like $allowedforums = explode(",", $vbulletin->options['sens_forumid']);
if (in_array($threadinfo['forumid'], $allowedforums))

How do i use the information of the selected forums creating a multiselect like this?
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #7  
Old 09 Oct 2013, 01:13
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Real name: Chris
I believe what you are after is something this.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
You can get access to my 180 mods for vB 3.6 - 4.x at The Admin Zone as well as the professional support you are used to. New vBulletin Spider Definitions, vBulletin Spiders List Hits 1000 Spiders! ​ OzzModz down. Site has had a data breach, checking how the intrusion happened. Change your PW if you use the same one on my site and others.
Reply With Quote
  #8  
Old 09 Oct 2013, 01:14
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
That works with the above?
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #9  
Old 09 Oct 2013, 01:17
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Real name: Chris
It should, the code I provided, works in my mods that I have a forum chooser in options, via a multi select field.
__________________
You can get access to my 180 mods for vB 3.6 - 4.x at The Admin Zone as well as the professional support you are used to. New vBulletin Spider Definitions, vBulletin Spiders List Hits 1000 Spiders! ​ OzzModz down. Site has had a data breach, checking how the intrusion happened. Change your PW if you use the same one on my site and others.
Reply With Quote
  #10  
Old 09 Oct 2013, 01:23
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Hmmm, i tried a variation of the code i provided and it didnt work, the code you provided gives an error
Parse error: syntax error, unexpected T_IF in /home/thecodec/public_html/forumz/showthread.php(112) : eval()'d code on line 31
--------------- Added 09 Oct 2013 at 01:25 ---------------

Errrr.....ummmm, guess who added an extra F to his own IF function!!!

My apologies!
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #11  
Old 09 Oct 2013, 01:26
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Real name: Chris
Ok here is how I do a forum chooser.

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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then you will need to do the plugin for admin_options_processing

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then you can use the code I provided earlier.
__________________
You can get access to my 180 mods for vB 3.6 - 4.x at The Admin Zone as well as the professional support you are used to. New vBulletin Spider Definitions, vBulletin Spiders List Hits 1000 Spiders! ​ OzzModz down. Site has had a data breach, checking how the intrusion happened. Change your PW if you use the same one on my site and others.
Reply With Quote
  #12  
Old 09 Oct 2013, 01:35
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Lol, thanks, did you see my note?
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #13  
Old 09 Oct 2013, 01:37
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Real name: Chris
Not until well after I had replied.
__________________
You can get access to my 180 mods for vB 3.6 - 4.x at The Admin Zone as well as the professional support you are used to. New vBulletin Spider Definitions, vBulletin Spiders List Hits 1000 Spiders! ​ OzzModz down. Site has had a data breach, checking how the intrusion happened. Change your PW if you use the same one on my site and others.
Reply With Quote
  #14  
Old 20 Jun 2015, 11:45
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Originally Posted by ozzy47 View Post
Ok here is how I do a forum chooser.

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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then you will need to do the plugin for admin_options_processing

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then you can use the code I provided earlier.



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

i user hook newthread_start with code


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but not work
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 16:24.

Layout Options | Width: Wide Color: