View Full Version : IF Condion in postbit template
techxpert
11-06-2008, 01:39 PM
I want to use a IF condition in postbit template like this
<if condition="$post['posts']>20">
SHOW SIGNATURE
</if>
so signature shows only for users with more than 20 posts.the problem is $post['posts'] variable return results as 5,678 and my condition fails because of comma(I guess its considered as string)
any solution you guys can suggest?
noppid
11-06-2008, 01:46 PM
You may need to add a line of code in the hook to do like $post[int_posts] = intval(str_replace(",","",$post[posts])). Then do your conditional on int_posts. I'm not sure if the integer value exists or not already in the $post array. I didn't read the code. If it does, you don't need a hook, just ID the var index and use it.
techxpert
11-06-2008, 03:15 PM
Can I edit something in showthread.php to accommodate this
I am not sure how hooks works
Gio~Logist
11-06-2008, 03:17 PM
$post['postcount'] is the variable you want.
noppid
11-06-2008, 03:18 PM
$post['postcount'] is the variable you want.
thanks!
Lynne
11-06-2008, 03:43 PM
Isn't $post[postcount] the post number in the thread? ie. this is post #6, thus $post[postcount] = 6
techxpert
11-06-2008, 11:24 PM
Yes Postcount Does not work,its serial number of post in the thread
any idea how I can get User no of posts in thread page in integer without commas formatting.
Lynne
11-07-2008, 02:45 AM
Did you try the suggestion in post 2? I think that is how you will have to do it as the variable is not available for use (they write over it in class_postbit.php - $this->post['posts'] = vb_number_format($this->post['posts']); ).
noppid
11-07-2008, 11:48 AM
Try the code I suggested in post 2 on hook showthread_postbit_create.
That's the postbit loop.
hook
$post[int_posts] = intval(str_replace(",","",$post[posts]));
templates condition
<if condition="$post[int_posts]>20">
SHOW SIGNATURE
</if>
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.