vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How to] Write Plug-ins/Hooks (https://vborg.vbsupport.ru/showthread.php?t=82625)

Opserty 08-15-2007 11:12 AM

Fair enough, I don't see why that link I posted wouldn't work the same in a plugin. Just do the same but instead of writing the hook in the PHP file stick it in your plugin. No harm in trying if you haven't already done so :p

Did you get some kind of error or was it just not working?

Lea Verou 08-15-2007 11:21 AM

I didn't try it yet, as I didn't need it at the time (I need it today).
I'll try soon though and post what happened.

amnesia623 09-03-2007 04:53 AM

Is this tutorial current as of vb 3.6.8?

I'm looking for a plugin tutorial and wondered if this is still relavent

Birched 09-21-2007 03:42 PM

The advice by KirbyDE at the end of the main entry was BY FAR the most useful part for me, but yes, I believe it is all still relevant.

Hubbitus 09-24-2007 12:04 PM

At the beginning, thank you for the good basic guide.

But I'm not completely understudying how I can associate my hook with two or more "hookname" at once? E.g. "newreply_post_start", "newthread_post_start".
Quote:

Originally Posted by Brad (Post 663102)
Code:

<title>vB Category Icons</title>
<hookname>forumdata_start</hookname>


If I try this code:
Code:

<title>vB Category Icons</title>
<hookname>newreply_post_start</hookname>
<hookname>newthread_post_start</hookname>

I get hook, associated to "useradmin_edit_start", as I understood the first item at the list.

Is it the only way to make the fully copy of the code into a new hook and associate it with new hookname???

Opserty 09-24-2007 03:03 PM

This tutorial is old. You can add plugins through the AdminCP via the Plugin Manager.

I don't think it is possible to associate the same code to two hooks. Just copy the code over to a new plugin to create code for another hook.

Hubbitus 09-24-2007 06:00 PM

Quote:

Originally Posted by Opserty (Post 1346069)
This tutorial is old. You can add plugins through the AdminCP via the Plugin Manager.

Of cause, I known. But, I'm don't known how associate the same code to two hooks in this case too.

Quote:

Originally Posted by Opserty (Post 1346069)
I don't think it is possible to associate the same code to two hooks. Just copy the code over to a new plugin to create code for another hook.

If no other, "normal" way, off cause i do that. But I hope that someone will prompt more correct way.

hobeau 10-05-2007 04:28 PM

Hi, I just want to display a list of users who have posted on a thread at the top of the thread using the hook system. I'm brand new to VBulletin and was wondering if there is a good tutorial or documentation that would help. I've looked in the vb manual and it just has like 2 pages on writing plugins. Can anyone help?

wottech 05-05-2009 04:34 PM

Quote:

Originally Posted by Ken Iovino (Post 887950)
If you wanted to do this is 3.5 using hooks you can. Open showthread.php and find around line: 923-924. You should see...

PHP Code:

$hook_query_fields $hook_query_joins '';
(
$hook vBulletinHook::fetch_hook('showthread_query')) ? eval($hook) : false

Under that you will see a very large query, in that query you will notice the variables, $hook_query_fields, and $hook_query_joins. Thats your ticket into this query.

You would simple go into the plugins, add new plugin and write it like so: Plugin Name is "showthread_query"
PHP Code:

$hook_query_fields ",tablename.rowname AS newname";
$hook_query_joins "LEFT JOIN " TABLE_PREFIX "tablename AS newtable ON(tablename.rowname = post.rowname)"



Is there a way to add WHERE and ORDER statements to this query as well, using hooks?


All times are GMT. The time now is 09:24 PM.

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.02411 seconds
  • Memory Usage 1,740KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete