vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How would I implement this code hack as a plugin (https://vborg.vbsupport.ru/showthread.php?t=137500)

telc 01-25-2007 03:37 PM

How would I implement this code hack as a plugin
 
In my file includes/class_dm_threadpost.php I wrapped an IF statement around the post count incrementor.

I made if so post counts are not incremented if the thread has certain text in the title.

PHP Code:

if(!strstr(strtoupper($this->info['thread']['title']),"HOWTO")) {
                                                
$user->set('posts''posts + 1'false);


How could I implement this as a plugin so I do not need to keep adding the code everytime I upgrade VB.

Thanks :up:

Reeve of shinra 01-25-2007 04:57 PM

1. (optional) Create a new product in the admincp (allows you to export import and link the plugins / templates /phrases)

2. Create a new plugin. Select the product and select a hook location. In the vb file your editing,... see if there is a hook (hook is in the name of the function) somewhere above the spot you edit.

3. Sit back and enjoy a beer.

telc 01-25-2007 05:04 PM

The hook location is far above the code I want to edit. So would I need to duplicate all that extra code in the plugin?

Reeve of shinra 01-25-2007 11:05 PM

No... dont do that. Just add the code you posted above in the plugin and use the hook you found to see if it works.

telc 01-26-2007 10:48 PM

Quote:

Originally Posted by Reeve of shinra (Post 1167347)
No... dont do that. Just add the code you posted above in the plugin and use the hook you found to see if it works.


That won't work, the hook it far above the location in the file I want to edit.

thincom2000 01-27-2007 02:33 PM

Instead of NOT incrementing the post count, since the hook is above where you made your edit:

Have the plugin subtract 1 from the post count if your conditions are true, then when it adds to the post count, it will seem as though it has not changed.


All times are GMT. The time now is 08:51 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.01088 seconds
  • Memory Usage 1,724KB
  • 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_php_printable
  • (1)bbcode_quote_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