View Full Version : Thread tags observation
BRotondi
10-21-2009, 01:57 PM
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
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, 02: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, 02:15 PM
O.K. Got it:
// ################################################## ############################
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_post delete2')) ? 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, 03:06 PM
Why do you want to add another hook there? Why not just use threadtag_domange_postdelete ?
BRotondi
10-21-2009, 07: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:
$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, 08: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, 05: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
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.