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 03-02-2015, 09:42 AM
irantk irantk is offline
 
Join Date: Mar 2007
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default template break when enable plugin

hi,
please help me.my plugin :

PHP Code:
$template_hook['tk_lastpost_server'] = $vbulletin->options['tk_lastposts_server'];

// forum permissions
$forumpermissions = array();
foreach (
$vbulletin->forumcache AS $forum) {
    
$forumpermissions[$forum["forumid"]] = fetch_permissions($forum['forumid']);
    if ((!(
$forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview'])) OR (!($forum['options'] & $vbulletin->bf_misc_forumoptions['active']) AND !$vbulletin->options['showprivateforums'] AND !in_array($vbulletin->userinfo['usergroupid'], array(567)))) {
        
$pforumids .= ',' $forum['forumid'];
    }
}
if (
$vbulletin->options['latest_exclude'] != '') {
    
$pforumids .= ',' $vbulletin->options['latest_exclude'];
}
$pforumids substr($pforumids1);
if (
$pforumids != '') {
    
$platest_and "thread.forumid NOT IN($pforumids)";
    
$platest_and_1 "forum.forumid NOT IN($pforumids)";
}

// converts options to nice variables
$limit $vbulletin->options['latest_number'];

$sql "SELECT post.postid, post.pagetext, post.userid, post.username, post.visible, post.dateline AS date, thread.forumid, thread.title as thread_title, thread.threadid, forum.forumid, forum.title as forum_title FROM  post as post
LEFT JOIN  thread as thread on (post.threadid = thread.threadid)
LEFT JOIN  forum as forum on (thread.forumid = forum.forumid)
WHERE post.visible = 1
ORDER BY postid DESC
LIMIT 10"
;

$query $vbulletin->db->query_read($sql);

$counter 0;
$latest_post_bits '';

while (
$row $vbulletin->db->fetch_array($query)) {
// allow to use alternate color in rows
    
require_once(DIR '/includes/functions.php');
    
exec_switch_bg();

// strips the bbcode out of the post
    
$row['pagetext'] = strip_bbcode($row['pagetext'], $stripquotes true$fast_and_dirty false$showlinks true);


// adds the cutoff ... with substr
    
$row['pagetext'] = substr($row['pagetext'], 0$vbulletin->options['latest_cut']) . '...';

// convert pagetext to nice looking variable
    
$ppostid $row['postid'];
    
$ppagetext htmlspecialchars($row['pagetext']);
    
$pusername $row['username'];
    
$puserid $row['userid'];
    
$pforumid $row['forumid'];
    
$pthreadid $row['threadid'];
    
$pforumtitle $row['forum_title'];
    
$pthreadtitle $row['thread_title'];
    
$pdate vbdate($vbulletin->options['dateformat'], $row['date'], true);
    
$ptime vbdate($vbulletin->options['timeformat'], $row['date']);

    
$counter++;
    
$templeter vB_Template::create('tk_lastpost_row');

    
$templeter->register('ppostid'$ppostid);
    
$templeter->register('pthreadtitle'$pthreadtitle);
    
$templeter->register('pdate'$pdate);
    
$templeter->register('ptime'$ptime);
    
$templeter->register('ppagetext'$ppagetext);
    
$templeter->register('pforumtitle'$pforumtitle);
    
$templeter->register('pusername'$pusername);
    
$templeter->register('template_hook'$template_hook);


    
$latest_post_bits .= $templeter->render();


}

$template_hook['tk_last_post'] = $latest_post_bits;
$templeter vB_Template::create('ad_global_below_navbar');
$templeter->register('template_hook'$template_hook);
$ad_location['global_below_navbar'] = $templeter->render(); 

in tk_lastpost_row

PHP Code:
{vb:raw pusername}
<
br


and in global_below navbar:
PHP Code:
<div id="lp" style="width:90%; margin-right:auto; margin-left:auto; border:solid">
<!-- 
our template code... -->
 {
vb:raw template_hook.tk_last_post}
</
div
Reply With Quote
  #2  
Old 03-02-2015, 10:23 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you mean exactly by "template break"? Also, which hook are you using for your plugin?
Reply With Quote
  #3  
Old 03-02-2015, 10:36 AM
irantk irantk is offline
 
Join Date: Mar 2007
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After login, get back to login and requested password again.
The login menu is in problems too.
i use: global_bootstrap_init_complete

thank you

Attachment 152006
Reply With Quote
  #4  
Old 03-02-2015, 02:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe try using hook global_bootstrap_complete instead.
Reply With Quote
  #5  
Old 03-02-2015, 03:06 PM
irantk irantk is offline
 
Join Date: Mar 2007
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately, this problem is not solved.
When setting "global_bootstrap_complete" hook would not show the messages. please see photo
I am waiting for your tips.

Attachment 152009
Reply With Quote
  #6  
Old 03-02-2015, 03:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, try hook parse_templates instead. I actually tried it this time and it looks like it works.
Reply With Quote
Благодарность от:
irantk
  #7  
Old 03-02-2015, 03:30 PM
irantk irantk is offline
 
Join Date: Mar 2007
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very very thank you :*

work for me <3
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 10:17 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.04038 seconds
  • Memory Usage 2,273KB
  • Queries Executed 12 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (1)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • 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