vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Please help me convert this code to vbb4 (https://vborg.vbsupport.ru/showthread.php?t=282142)

Easy5s.net 04-28-2012 01:40 AM

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.

kh99 04-28-2012 11:46 AM

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.

Easy5s.net 04-28-2012 12:03 PM

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

kh99 04-28-2012 01:04 PM

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);    



Easy5s.net 04-28-2012 01:43 PM

i'm try it but not work :(

{vb:raw post.credits} not show

kh99 04-28-2012 02:05 PM

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?

Easy5s.net 04-28-2012 03:47 PM

ok because at least one field in the user table :)

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

thank advanced.

kh99 04-28-2012 03:55 PM

Quote:

Originally Posted by Easy5s.net (Post 2324349)
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.


All times are GMT. The time now is 05:27 AM.

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.01114 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete