Bug Class USERTAG not found

Status
Not open for further replies.
We have a custom very simple plugin that has worked fine for years but DOES NOT work when the user tagging addon is installed. The error logs show that PHP couldn't find the USERTAG class. Here is the error:

Code:
PHP Fatal error:  Class 'USERTAG' not found in /home/site/public_html/vb/dbtech/usertag_pro/actions/parse/hash.php on line 11

Here is our code, which runs at the paidsub_build hook.

PHP:
if($subscriptionid == 17) {

$post_forumid = 167;
$post_userid = 40409;
$post_userinfo = fetch_userinfo($post_userid);
$post_foruminfo = fetch_foruminfo($post_forumid);

$subject = 'New TESTING OFFSITE subscription for ' . $user['username']; 
$message = '[url=http://www.site.com/vb/member.php/' . $user['userid'] . '-' . $user['username'] . ']' . $user['username'] . '[/url] has just purchased a vendor subscription';



$threadman =& datamanager_init('Thread_FirstPost', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_info('forum', $post_foruminfo);
$threadman->set_info('is_automated', true);
$threadman->set_info('skip_moderator_email', true);
$threadman->set_info('mark_thread_read', true);
$threadman->set_info('parseurl', true);
$threadman->set('allowsmilie', true);
$threadman->set('userid', $post_userinfo['userid']);
$threadman->setr_info('user', $post_userinfo);
$threadman->set('title', $subject);
$threadman->set('pagetext', $message);
$threadman->set('forumid', $post_foruminfo['forumid']);
$threadman->set('visible', 1);
$threadman->set('ipaddress', '');
$threadman->save();
}

As you can see, it simply sets up a threadmanager instance and uses it to make a new thread. As I said, this code has worked fine for years. Only when the advanced user tagging pro product is installed does it not work. More importantly for troubleshooting, is that if I add the subscription to a user via the admincp, the code runs fine, no errors. Only when the Paypal IPN fires does it error out. Again, when the advanced user tagging pro addon is installed, adding a paid subscription to user via admincp, the code runs fine but when the code is run through the paypal IPN, it errors out complaining about not being able to find the USERTAG class. When the advanced user tagging pro product is disabled, the code works fine in both scenarios.
 
Last edited:
Adding

PHP:
require_once(DIR . '/dbtech/usertag/includes/class_core.php');
require_once(DIR . '/dbtech/usertag/includes/class_cache.php');
to the top of dbtech/usertag_pro/actions/parse/hash.php fixes the problem entirely. I will investigate further. I'm guessing that the global_start hook isn't run when the IPN hits.
 
VB's payment_gateway.php does not include global.php in its bootstrapping process. Therefore the global_start hook is never run from that script. Therefore, your USERTAG class is never defined when that script runs.

So our bug is squashed, but please fix this in a future release so that when we upgrade we don't break everything again.
 
To be fair, this isn't a bug in our mod as it's your custom code - you can most likely fix it by editing your code and finding
PHP:
if($subscriptionid == 17) {
and adding below that
PHP:
if (file_exists(DIR . '/dbtech/usertag/hooks/global_start.php') AND $this->registry->products['dbtech_usertag'])
{
	global $vbulletin;
	require_once(DIR . '/dbtech/usertag/hooks/global_start.php');
}
 
To be fair, our code works fine without the advanced tagging product enabled, and has worked fine for a long time. If VB didn't see the need to include global.php inside payment_gateway.php, I'm certainly not going to do it. That's a big payload to inject into a script that isn't expecting it and it's entirely possible that it could introduce even more issues into the payment processing portion of VB.
 
To be fair, our code works fine without the advanced tagging product enabled, and has worked fine for a long time. If VB didn't see the need to include global.php inside payment_gateway.php, I'm certainly not going to do it. That's a big payload to inject into a script that isn't expecting it and it's entirely possible that it could introduce even more issues into the payment processing portion of VB.
The code I gave you did not include global.php. It simply correctly initialises AUT.
 
Hello badgerandblade,

This ticket has now been closed with the status Not A Bug.

We hope your issue or question has been addressed to your satisfaction. If not, please feel free to re-open it by clicking this link.

If you have any further issues or questions, please feel free to start a new support ticket via the button at the top of every page.

Thank you!
 
Status
Not open for further replies.

Legacy Advanced User Tagging

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
2,505
Customer rating
0.00 star(s) 0 ratings
Back
Top