The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help converting a short template mod to VB4
I had this installed on my 3.x forum and worked flawlessly, however with the vb4 upgrade I just did I am completely out of date with the new code structure of vb4. Can someone lend a hand as to what I need to do to get this to work now? It was a great add-on for our board.
It was lifted and customized a little more from this original mod. http://www.vangic.eu/forum/printthread.php?t=44 This is how I last had it running on VB 3.5+ up until I installed to vb4. This is in the postbit template. HTML Code:
<if condition="THIS_SCRIPT == 'showthread'"> <if condition="$jointime > 1825"><img src="$stylevar[imgdir_misc]/goldstar.png"/> <if condition="$jointime > 3285"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 2920"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 2555"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 2190"><img src="$stylevar[imgdir_misc]/star.png" /></if> <else /> <if condition="$jointime > 1460"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 1095"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 730"><img src="$stylevar[imgdir_misc]/star.png" /></if> <if condition="$jointime > 365"><img src="$stylevar[imgdir_misc]/star.png" /></if> </if> </if> |
#2
|
|||
|
|||
well, i am not that deep into vb4 coding as well, but i think its just a tiny one....
you have to change <if into <vb:if and </if> into </vb:if> |
#3
|
|||
|
|||
HTML Code:
<vb:if condition="THIS_SCRIPT == 'showthread'"> <vb:if condition="$jointime > 1825"><img src="{vb:stylevar imgdir_editor}/goldstar.png"/></vb:if> <vb:if condition="$jointime > 3285"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 2920"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 2555"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 2190"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:else /> <vb:if condition="$jointime > 1460"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 1095"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 730"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> <vb:if condition="$jointime > 365"><img src="{vb:stylevar imgdir_editor}/star.png" /></vb:if> </vb:if> |
#4
|
|||
|
|||
No dice. Did they change the $jointime variable in the vb4 codebase?
Just a thought. Also, I even changed the links to absolute to try and alleviate the problem. Still no go. HTML Code:
div class="username_container"> <vb:if condition="$post['userid']"> <vb:if condition="THIS_SCRIPT == 'showthread'"> <vb:if condition="$jointime > 1825"><img src="http://www.spadsm.com/forum/images/goldstar.png"/></vb:if> <vb:if condition="$jointime > 3285"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 2920"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 2555"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 2190"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:else /> <vb:if condition="$jointime > 1460"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 1095"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 730"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> <vb:if condition="$jointime > 365"><img src="http://www.spadsm.com/forum/images/star.png" /></vb:if> </vb:if> {vb:raw memberaction_dropdown} Also, shouldn't $jointime be represented as {vb:var jointime} or use the {vb:raw} format? I've tried multiples of configurations and nothing is working, it can't be that hard. |
#5
|
||||
|
||||
I would guess you have not registered the variable $jointime for use in the template. When writing a condition, you would use $jointime, not {vb:var jointime}
|
#6
|
|||
|
|||
Quote:
I did create a plugin which was suggested under the original modification and it worked flawlessly throughout the 3.x cycle. What can I do? |
#7
|
||||
|
||||
As Lynne says, you will need to register $jointime to work in the template. The code you posted also seems to have mis-matched IFs.
Im also puzzled about what its supposed to be doing - why do you have an IF based on the scriptname ? |
#8
|
|||
|
|||
Quote:
2) The <IF> based on the script name was something that someone else suggested as a fix for the 3.x version when it wouldn't show up in the PM system. If I take it out now it actually deletes the userID shown in a post so I opted to leave it in for the vb4 rewrite. To clarify, the mod is supposed to award stars for years of membership. 1 Year you get a starr, 2 years, you get 2 and so forth. I just further customized it to award a gold star for 5 years of service as our board has some members going on 10 years and showing 10 stars was kind of redundant. It is displayed either above, or below the username on every post. |
#9
|
||||
|
||||
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
|
#10
|
|||
|
|||
Quote:
Where do I register this (put the code)? In a plugin? In the template? vb4 is so different! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|