vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Thread tags observation (https://vborg.vbsupport.ru/showthread.php?t=225700)

BRotondi 10-21-2009 12:57 PM

Thread tags observation
 
Hello

I'm using thread tags to categorize threads. So I want to log tag changes.

As a first step I tried to send me an email after each change. But i failted to create a plugin with something like
Code:

vbmail($vbulletin->options['webmasteremail'], "Tags Changed",
"User: " . $vbulletin->userinfo['userid'] . "\r\n"
. "Forum: " . $threadinfo['forumid']) . "\r\n"
. "Thread: " . $threadinfo['threadid']) . "\r\n"
. "Title: " . $threadinfo['title']) . "\r\n"
. "------------------------------------" . "\r\n"
. "New tags:  " . $$$ . "\r\n"
. "Old tags: " .  $$$
, true);

Problem: Which hook and which file changes are necessary to make this run? It's quite complicated ...

Is there some code / addon or similar I could use? Or any idea?

Thanks for any help!

Bruno

Lynne 10-21-2009 01:13 PM

If you are trying to log tag changes, then find the area in the code where tag changes are actually submitted and then pick a hook location there. Which pages have you been looking at to find hook locations?

BRotondi 10-21-2009 01:15 PM

O.K. Got it:
Code:

// ##############################################################################
if ($_POST['do'] == 'managetags')
{
    //B
    $Btmp = $threadinfo['taglist'];

(...)

    //B
    $threadinfo = fetch_threadinfo($threadinfo['threadid'], false); // get updated tag list
    $threadinfo['
taglistOld'] = $Btmp;

    ($hook = vBulletinHook::fetch_hook('threadtag_domanage_postdelete2')) ? eval($hook) : false;

    if ($vbulletin->GPC['ajax'])
    {
        //B $threadinfo = fetch_threadinfo($threadinfo['threadid'], false); // get updated tag list

Now you can Use threadtag_domanage_postdelete2 which has to be added in includes/xml/hooks_vbulletin.xml (after threadtag_domanage_postdelete)

Or are there any better ideas than manipulate the php and add a hook?

Thanks!
Bruno


--------------- Added 21 Oct 2009 at 17:17 ---------------

Thanks Lynne for you reply. I tried what you said, but its REALLY complicated... even impossible without code changes I think...

Lynne 10-21-2009 02:06 PM

Why do you want to add another hook there? Why not just use threadtag_domange_postdelete ?

BRotondi 10-21-2009 06:11 PM

I don't know, what threadtag_domange_postdelete is for. At this moment, the new tags are not verified and definitly set... these Lines MUST be executed, before I know if tags have been changed:
Code:

$vbulletin->GPC['ajax']
$threadinfo = fetch_threadinfo($threadinfo['threadid'], false); // get updated tag list

And after these... no hook will come any more...

Greetings, Bruno

Lynne 10-21-2009 07:19 PM

What is your overall idea of what you want done? Why do you need to be notified *before* the change? And do you expect the change to stop until you do something here? I would think that would be quite complicated to do.

BRotondi 10-22-2009 04:26 AM

Hi Lynne

Since a thread can have only one prefix, I use tags instead. So more security is necessary:
  • after some time only mods should be able to change (perhaps not necessary, first I want to see how the changes are made)
  • I want to log every change to get an idea how the users are managing the tags, to see when a good category (tag) has been deleted (only possible by mods) or a bad has been added (all users)
I added the 2nd hook instead of putting all the code there to minimize file changes ... perhaps I should better take the other approach and put all code there...

Thanks for your support!
Greetings, Bruno


All times are GMT. The time now is 02:32 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.01868 seconds
  • Memory Usage 1,722KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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