vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Small problem... My plugin keeps repeating itself... (https://vborg.vbsupport.ru/showthread.php?t=182003)

4x4 Mecca 06-09-2008 01:51 PM

Small problem... My plugin keeps repeating itself...
 
What I mean is, I have a plugin that is supposed to replace something in the postbit with additional info, but it repeats that additional info more for each poster in the thread, so for example their post count looks like this

Posts: 125!

next user

Posts: 36,588!!

Next user

Posts: 16!!!

and so on adding more ! every time, here is the code, and I'm using postbit_display_complete because it's the only one that actually even inserts the data. Thanks for your help
Code:

$stuff="!";
$lookfor='$vbphrase[posts]: $post[posts]';
$replace='$vbphrase[posts]: $post[posts] $stuff';
$vbulletin->templatecache['postbit_legacy'] = str_replace($lookfor,  $replace, $vbulletin->templatecache['postbit_legacy']);


Opserty 06-09-2008 02:04 PM

The template cache only needs to be edited once... you are editing it each time the postbit is displayed. Find another hook location for the plugin, e.g. showthread_start or something. (One that does not get repeated).

4x4 Mecca 06-09-2008 02:09 PM

it works now, I moved everything from the $replace section into the $stuff section and it works great.

Opserty 06-09-2008 02:28 PM

But your code only needs to be executed once, you are executing it each time the postbit is displayed.

4x4 Mecca 06-09-2008 05:20 PM

thanks, I will try another hook.

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

i have tried about 7 different hooks, this is the only one that shows the info.

Opserty 06-10-2008 05:56 AM

Hmm what hooks did you try? Did you try showthread_start as I suggested? (By only "shows the info", do you mean only one that shows the changes the plugin makes?)


All times are GMT. The time now is 03:46 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.02834 seconds
  • Memory Usage 1,715KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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