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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2012, 01:40 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Please help me convert this code to vbb4

Please help me convert this code to vbb4
Thanks a lot.

Code:
if ($vbulletin->options['on_off'] AND (THIS_SCRIPT=='showthread' OR THIS_SCRIPT=='showpost')){
	$location = '$template_hook[postbit_userinfo_right_after_posts]';	
	$vbulletin->templatecache['postbit_legacy'] = str_replace($location,$location.fetch_template('postbit_point'),$vbulletin->templatecache['postbit_legacy']);	
	$vbulletin->templatecache['postbit_first'] = str_replace($location,$location.fetch_template('postbit_point'),$vbulletin->templatecache['postbit_first']);
	$vbulletin->templatecache['postbit'] = str_replace($location,$location.fetch_template('postbit_point'),$vbulletin->templatecache['postbit']);
}
--------------- Added [DATE]1335605202[/DATE] at [TIME]1335605202[/TIME] ---------------

bump.

--------------- Added [DATE]1335614520[/DATE] at [TIME]1335614520[/TIME] ---------------

bump.
Reply With Quote
  #2  
Old 04-28-2012, 11:46 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's not enough information there. You might be able to do it by rendering the postbit_point template, but if it uses any varibles they would have to be registered to the template before rendering. Also, it's strange that a str_replace is used instead of just using the template hook, but it could be that the template couldn't be rendered at that point because some variables hadn't been set yet.
Reply With Quote
  #3  
Old 04-28-2012, 12:03 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hook Location: parse_templates

Plugin PHP Code:
PHP Code:
if ($vbulletin->options['mod_on_off'] AND (THIS_SCRIPT=='showthread' OR THIS_SCRIPT=='showpost')){
    
$location '$template_hook[postbit_userinfo_right_after_posts]';    
    
$vbulletin->templatecache['postbit_legacy'] = str_replace($location,$location.fetch_template('postbit_credits'),$vbulletin->templatecache['postbit_legacy']);    
    
$vbulletin->templatecache['postbit_first'] = str_replace($location,$location.fetch_template('postbit_credits'),$vbulletin->templatecache['postbit_first']);
    
$vbulletin->templatecache['postbit'] = str_replace($location,$location.fetch_template('postbit_credits'),$vbulletin->templatecache['postbit']);

Temp:

postbit_credits:

Code:
<if condition="$bbuserinfo[userid]">
<div class="postbit_field">
	<span class="postbit_text">Credits:</span> 
		$post[credits] (<a href="credit_system.php?$session[sessionurl]do=maincreditsystem"><span class="postbit_text">$vbphrase[credit_tranfer]
	<span></a>)
</div>
</if>
i want show temp postbit_credits in showthread
Reply With Quote
  #4  
Old 04-28-2012, 01:04 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this: First change template postbit_credits to:

Code:
<vb:if condition="$bbuserinfo[userid]">
<div class="postbit_field">
	<span class="postbit_text">Credits:</span> 
		{vb:raw post.credits} (<a href="credit_system.php?{vb:raw session.sessionurl}do=maincreditsystem"><span class="postbit_text">{vb:rawphrase credit_tranfer}
	<span></a>)
</div>
</vb:if>

Then, use hook location postbit_display_complete instead of parse_templates, and change the code to this:

PHP Code:
if ($vbulletin->options['mod_on_off'] AND (THIS_SCRIPT=='showthread' OR THIS_SCRIPT=='showpost'))
{
    
$template vB_Template::create('postbit_credits');
    
$template->register('post'$post);
    
$template_hook[postbit_userinfo_right_after_posts] .= $template->render();
    unset(
$template);    

Reply With Quote
Благодарность от:
Easy5s.net
  #5  
Old 04-28-2012, 01:43 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'm try it but not work

{vb:raw post.credits} not show
Reply With Quote
  #6  
Old 04-28-2012, 02:05 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I tested it and it works for me. I didn't get any actual number for credits because I don't have the rest of the mod installed, but I got "Credits: ( )" added to my postbit.

How did you make the changes, did you edit the xml file?
Reply With Quote
  #7  
Old 04-28-2012, 03:47 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok because at least one field in the user table

and i want add {vb:raw post.credits} to header?

thank advanced.
Reply With Quote
  #8  
Old 04-28-2012, 03:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Easy5s.net View Post
ok because at least one field in the user table
I don't understand.


Quote:
and i want add {vb:raw post.credits} to header?

thank advanced.
I don't know how to do that. Some part of the mod is putting the value in $post[credits], but there is no $post available in the header.
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 11:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08301 seconds
  • Memory Usage 2,248KB
  • Queries Executed 13 (?)
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_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete