Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[vBulletin|PHP]vBulletin options and conditionals
Ziki
Join Date: Nov 2005
Posts: 2,704

It appears that I am still alive

by Ziki Ziki is offline 24 Dec 2006

Want to bring your new product onto a new level and use vBulletin options as well?Here we go

To create a simple on/off option just enter the vBulletin option admincp.Now insert the values for your desired option,when you get to the type sellect boolean.I won't describe the other types here.Boolean returns values true/1 if the condition was correct and false/0 if it wasn't.

So the variable for a vb option is $vbulletin->options['OPTIONNAME'] in plugins and php code and for templates use $vboptions[OPTIONNAME] (notice,no apostrophes in templates).So to make a simple condition:


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

If specifies the condition inside the brackets.If you use just the variable without the comparism sign (==) then it will think that you are checking if it is 1.

Oh I forgot,Yes = 1 and No = 0

Did you notice the else?That is executed if the condition is anything else than what we are checking with.But you can extend your code with another elseif


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

This was a very basic introduction into using PHP conditionals with vBulletin boolean (Yes/No) options .

Last edited by Ziki; 16 May 2009 at 07:06..
Views: 10635
Reply With Quote
Comments
  #2  
Old 24 Dec 2006, 18:56
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Real name: Shawn

Looks basic but understanding for me is slow :cross-eyed:
Reply With Quote
  #3  
Old 24 Dec 2006, 23:30
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
What don't you understand?
__________________
My free mods~click here
Reply With Quote
  #4  
Old 13 Jan 2007, 06:03
DollarBill DollarBill is offline
 
Join Date: Jan 2007
I understand it all except the part where you find and identify which conditions can be used and where/when/etc.
Reply With Quote
  #5  
Old 13 Jan 2007, 10:07
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Real name: Hanson
[QUOTE=Ziki;1144546]This has to start with an if condition and end with an else.elseifs belong between those two./QUOTE]
No it doesn't. You can end with just an if or elseif. You only need to start with an if.
__________________
Former vBulletin.org Staff Member

View My Modifications
29 Releases and Counting... Latest Modification: dmActivityStream - vBookie Integration (4.x)

Please do not PM me to ask for support - please use the relevant thread or forum.
Reply With Quote
  #6  
Old 14 Jan 2007, 07:57
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Well yeah that's what iI said.
__________________
My free mods~click here
Reply With Quote
  #7  
Old 19 Jan 2007, 16:25
thincom2000 thincom2000 is offline
 
Join Date: Jun 2006
Real name: Ted
He just means you shouldn't put an elseif after an else. That would result in an 'UNEXPECTED ...' error.
Reply With Quote
  #8  
Old 20 Jan 2007, 14:32
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Yes that's what I said!
__________________
My free mods~click here
Reply With Quote
  #9  
Old 20 Jan 2007, 16:34
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Real name: Billy
So would this work?

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

Or do we put the HTML in the place where code 1 and code 2 was?
Then, how do I install it? I am trying to make a Member of the Month code for my board and all this is confusing for a newbie to XML/Programming stuff for vBulletin Options.
__________________
I am dropping support for vBulletin.
Sorry.
Reply With Quote
  #10  
Old 20 Jan 2007, 16:40
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Yes but that is php code that is inserted into plugins
__________________
My free mods~click here
Reply With Quote
  #11  
Old 20 Jan 2007, 16:57
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Real name: Billy
Ah ok, thanks for the info.
__________________
I am dropping support for vBulletin.
Sorry.
Reply With Quote
  #12  
Old 16 May 2009, 07:06
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Updated
__________________
My free mods~click here
Reply With Quote
  #13  
Old 17 Jun 2009, 17:46
imported_silkroad imported_silkroad is offline
 
Join Date: Dec 2003
Sorry, but how do we get the options to show up in the vB Options area of the AdminCP?

Thanks!

--------------- Added 17 Jun 2009 at 20:24 ---------------

Originally Posted by imported_silkroad View Post
Sorry, but how do we get the options to show up in the vB Options area of the AdminCP?

Thanks!
Nevermind... I figured it out.

Just use phpMyAdmin to create a new option in the settings table. Then, following the format in vBphrases, setting_name_of_your_db_option_title and setting_name_of_your_db_option_desc, create your phrases and you are done

Very nice

Last edited by imported_silkroad; 17 Jun 2009 at 20:24. Reason: Auto-Merged DoublePost
Reply With Quote
  #14  
Old 19 Jun 2009, 14:33
Centrix Centrix is offline
 
Join Date: Sep 2005
Isn't it supposed to be:

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

Reply With Quote
  #15  
Old 20 Jun 2009, 13:48
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
No, that's not an else if just another condition inside else.
__________________
My free mods~click here
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 10:03.

Layout Options | Width: Wide Color: