Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 13 May 2016, 04:52
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Angry [SOLVED] vbulletin doesn't like ternary operators?

for simplistic code sake I'm trying to use ternary operators in my products.

Here's what im trying to simplify:


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

Now I have tried


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


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


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

not one of these worked =/

although

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

does use the postcard option but it does whether the option is yes or no

btw

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

is a simple yesno boolean

where am i going wrong =/
__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz

Last edited by Dr.CustUmz; 13 May 2016 at 21:39.
Reply With Quote
  #2  
Old 13 May 2016, 14:29
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
vBulletin does like it, it's just that you probably use the if statement wrong of the ternary operator.

Does $vbulletin->options['drc_embed_vine_smpl'] literally contain a boolean: true/false or does it contain a number 1 (true) and 0 (false)?

If it's really a boolean, then the following should work just fine:

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

If it contains a number:

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

__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #3  
Old 13 May 2016, 17:18
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
It does return a number, but for some reason it still not working, the option exist. I do toggle it one to the other, but it always shows postcard.

I Tried

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

and


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

this is the plugin

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

and the option

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

__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz
Reply With Quote
  #4  
Old 13 May 2016, 17:22
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Add the following somewhere before you call the ternary operator so you can see what it contains:

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

__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #5  
Old 13 May 2016, 17:29
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
i placed it at the beginning of the plugin, this is what it spat out in my showthread.

__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz
Reply With Quote
  #6  
Old 13 May 2016, 17:40
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Adding the product for reference

I changed the option in this version, thinking maybe i had a conflict, but no luck
Attached Files
File Type: xml [DRC] - Auto Embed Vine.xml (2.3 KB, 4 views)
__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz

Last edited by Dr.CustUmz; 13 May 2016 at 17:47.
Reply With Quote
  #7  
Old 13 May 2016, 18:53
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
drc_embed_vine_smpl is not defined in your import file. I think you're using the wrong variable.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #8  
Old 13 May 2016, 19:41
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Originally Posted by Dave View Post
drc_embed_vine_smpl is not defined in your import file. I think you're using the wrong variable.
i change it all to "drc_ae_vine_styl" in that version attached thinking maybe I had a conflict somewhere.
__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz
Reply With Quote
  #9  
Old 13 May 2016, 21:06
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I think you need to globalize $vbulletin in the postbit_display_complate hook location.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #10  
Old 13 May 2016, 21:09
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Originally Posted by Lynne View Post
I think you need to globalize $vbulletin in the postbit_display_complate hook location.
ive never had to do this, but have seen it done somewhere before.

this is as simple as adding

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

correct?

--------------- Added 13 May 2016 at 21:26 ---------------

yup, THANK YOU SO MUCH LYNNE!

I had no clue why this wouldn't work, so for future ref. how do I know when I need to globalize a var other than just giving it a shot lol
__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz
Reply With Quote
  #11  
Old 13 May 2016, 23:19
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
I discovered once I began publishing products that even though I might not need to globalize variables on my site(s), other folks would have issues because it wasn't available on theirs. I don't know why this is.

So as insurance, I now tend to globalize $vbulletin, $vbphrase, $db whenever I use them in any plugin just to make sure this won't be an issue for anyone who installs my products.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #12  
Old 14 May 2016, 00:23
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Real name: Paul M
You dont need to globalize it, and its bad practice to do so.

What you need to do is use the correct variable, which in a lot of core class functions is $this->registry, not $vbulletin.

(e.g. $this->registry->options['xxx'], not $vbulletin->options['xxx']).
__________________
Former vBulletin.org Staff Member


Cable Forum
Please do not PM me about custom work - I no longer undertake any.
Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum.
Reply With Quote
  #13  
Old 14 May 2016, 02:13
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Originally Posted by Paul M View Post
You dont need to globalize it, and its bad practice to do so.

What you need to do is use the correct variable, which in a lot of core class functions is $this->registry, not $vbulletin.

(e.g. $this->registry->options['xxx'], not $vbulletin->options['xxx']).
-_- facepalm, seeing this now I remember, Ive used that before. Thanks Paul =)
__________________
Sorry been away so long, new baby, got married, got into GM, just got to the point I can resume developing.
I'm working on a bunch of products, some free, some paid, and will release them all at once.
Dirt RIF CustUmz
Reply With Quote
Reply



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

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 08:29.

Layout Options | Width: Wide Color: