vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=193313

Why i canīt get it work?
by maar3amt
10 Oct 2008 23:04

Hi ppl
Why i can't get this code work on postbit_legancy?


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


orryun 10 Oct 2008 23:48

Your code works fine with me.
Where exactly doesn't this code work?
Try insert DIV tags, like so: <div>Some text</div>

Lynne 10 Oct 2008 23:56

Maybe try $post['posts']

orryun 11 Oct 2008 00:20

Quote:

Originally Posted by Lynne (Post 1642325)
Maybe try $post['posts']

I have tried the $post[posts] thingy and it worked nicely on vB 3.8.0 b1

I think it's about the location of the code.

Lynne 11 Oct 2008 00:34

Quote:

Originally Posted by orryun (Post 1642334)
I have tried the $post[posts] thingy and it worked nicely on vB 3.8.0 b1

I think it's about the location of the code.

Yeah, could be. I can never remember when to use quotes and when not to. One of these days I'll learn!

maar3amt 11 Oct 2008 02:00

well on left side after user avatar i want show a message if user have more than 200 posts like.
<if condition="$post[posts] >= 200">
I have more than 200 posts
</if>
<else>
I have less thab 200 posts

Lynne 11 Oct 2008 04:46

Well, your condition is written incorrectly:


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


Dismounted 11 Oct 2008 05:19

$post[posts] is equal to $post['posts'] and is also equal to $post["posts"] if no constant with the name "posts" exists. PHP will actually output a warning if you do not quote the array key. PHP actually first searches for a constant called "posts", then it looks up the array for an element with key "posts".

maar3amt 12 Oct 2008 16:27

Yes this code work if user ha less than 1,000 posts if have higher don't work propely.

Lynne 12 Oct 2008 17:32

Quote:

Originally Posted by maar3amt (Post 1643383)
Yes this code work if user ha less than 1,000 posts if have higher don't work propely.

Yes, that is correct. The variable is actually a formatted variable and so if you wish to do comparisons to it with numbers greater than 1,000, you need to deal with it using php code and thus in a plugin.



edit to add: You can always do the reverse comparison and it should work:

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


Marco van Herwaarden 14 Oct 2008 10:13

Quote:

Originally Posted by Lynne (Post 1643425)
edit to add: You can always do the reverse comparison and it should work:

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

Nope that would not work.

Consider a user with 1100 posts. This would be formatted as "1.100".

"1.100 <= 200" will be true!! ("1.100" will be casted to a numeric and will result in "1")

Only (good) solution is to create a plugin that store the postcount in a seperated variable before it is formatted.


All times are GMT. The time now is 02:50.

Powered by vBulletin® Version 3.8.14
Copyright © 2021, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.