The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
if post count conditional
Hi everyone,
Fairly sure this is a simple request, but can't quite figure out how to do it. I want to include a conditional statement in a users postbit if the user has made more then X posts. I know I can get the total number of posts from the user using this {vb:raw post.posts} That returns a number like 1,784 How can use that variable in a conditional though? Essentially 'if {vb:raw post.posts} > 1000' Do this..... Can anyone help out? What's the correct syntax? Cheers, hilaryl |
#2
|
||||
|
||||
HTML Code:
<vb:if condition="$post['posts'] > 1000"> Code Here </vb:if> |
#3
|
|||
|
|||
Thanks for the code.
Unfortunately this isn't working though, and I'm fairly sure it's because '$post['posts']' is equal to a number with a comma in it. As in it's equal to '1,060'. How can I turn '1,060' into '1060' so I can compare the numbers? |
#4
|
||||
|
||||
Make a new plugin
Product = vBulletin Hook Location = postbit_display_complete Title = what ever you want for a tiltle Execution Order = 5 Plugin PHP Code PHP Code:
Plugin is Active = check to Yes New Condition HTML Code:
<vb:if condition="$post['new_user_posts'] > 1000"> Code Here </vb:if> |
2 благодарности(ей) от: | ||
Lynne, nolimitreef |
#5
|
|||
|
|||
Fantastic - thanks for being so thorough with your explanation.
I'll give it a go shortly and let you know how I go. Thanks, hilaryl --------------- Added [DATE]1427333234[/DATE] at [TIME]1427333234[/TIME] --------------- Works like a charm! Actually ended up tweaking it a bit and added what I wanted into another template_hook so I don't have to alter the post_bit template. Full plugin code below: HTML Code:
$new_user_posts = str_replace(',', '', $post['posts']); if ($new_user_posts > 500) { $template_hook['postbit_userinfo_right_after_posts'] .= '<!--<dt></dt><dd>' . $new_user_posts . '</dd>-->'; } |
2 благодарности(ей) от: | ||
Lynne, nolimitreef |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|