Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2010, 03:14 AM
Booost This Booost This is offline
 
Join Date: May 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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>
Any help would be greatly appreciated!
Reply With Quote
  #2  
Old 04-28-2010, 04:57 AM
bpr bpr is offline
 
Join Date: Dec 2009
Location: London
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #3  
Old 04-28-2010, 09:56 AM
Mr Happy Mr Happy is offline
 
Join Date: Aug 2009
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Try this. It should work. If not let us know
Reply With Quote
  #4  
Old 04-28-2010, 03:37 PM
Booost This Booost This is offline
 
Join Date: May 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}
--------------- Added [DATE]1272478016[/DATE] at [TIME]1272478016[/TIME] ---------------


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.
Reply With Quote
  #5  
Old 04-28-2010, 11:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}
Reply With Quote
  #6  
Old 04-29-2010, 12:08 AM
Booost This Booost This is offline
 
Join Date: May 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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}
Well regardless of what variable I try to use, it still does not work.

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?
Reply With Quote
  #7  
Old 04-29-2010, 12:37 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
  #8  
Old 04-29-2010, 12:41 AM
Booost This Booost This is offline
 
Join Date: May 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
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 ?
Ok, well 1) how do I register $jointime?

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.
Reply With Quote
  #9  
Old 04-29-2010, 02:45 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Booost This View Post
Ok, well 1) how do I register $jointime?
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
Reply With Quote
  #10  
Old 04-29-2010, 03:23 AM
Booost This Booost This is offline
 
Join Date: May 2004
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
Thanks but now i'm even more confused.

Where do I register this (put the code)? In a plugin? In the template?

vb4 is so different!
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 02:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04833 seconds
  • Memory Usage 2,277KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_html
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete