xF1 Add-on - Run query on user upgrade (code example) | NulledTeam UnderGround | The Best Scripts Site In The World
  • Read Our Rules

    Dont forget read our rules Nulled Team UnderGround Rules

  • You may not say thanks or replied bad language in a thread - Your reply will be removed and warning! You must be like us "overview" in the resource. You will be access to download in FREE SECTION ONLY! DO NOT PREMIUM SECTION! Is only upgrade to up account.
  • Please support our site and click on the advertised
  • Complete Installation Service

    Review Our XenForo Complete Installation Service
  • Multiple Accounts

    Dont forget we not allowed Multiple Accounts, so all of your accounts as well as your IP will ban

Resource icon

xF1 Add-on Run query on user upgrade (code example) 1.x

No permission to download
You can edit the library/ExtendUserUpgrade/UserUpgradeModel.php file to set your own query or code to execute when a user pays for an upgrade. The file already includes a query that I used for the person I made this for:

Code:
<?php

class ExtendUserUpgrade_UserUpgradeModel extends XFCP_ExtendUserUpgrade_UserUpgradeModel
{
public function upgradeUser($userId, array $upgrade, $allowInsertUnpurchasable = false, $endDate = null)
{
$retval = parent::upgradeUser($userId, $upgrade, $allowInsertUnpurchasable, $endDate);

$db = XenForo_Application::get('db');

$db->query("
UPDATE iConomy
SET Balance = Balance + 3000
WHERE username = (
SELECT username
FROM xf_user
WHERE user_id = " . $userId . "
)
");

return $retval;
}
}
But he ended up needing to connect to a second database to update user records for his minecraft server. Here is an example with a second database connection. $db is the database for XenForo. $mcdb is the database for his minecraft server. This allowed him to query both databases to update point values:

Code:
<?php

class ExtendUserUpgrade_UserUpgradeModel extends XFCP_ExtendUserUpgrade_UserUpgradeModel
{
public function upgradeUser($userId, array $upgrade, $allowInsertUnpurchasable = false, $endDate = null)
{
$retval = parent::upgradeUser($userId, $upgrade, $allowInsertUnpurchasable, $endDate);

$db = XenForo_Application::get('db');
$mcdb = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => 'localhost',
'username' => 'dbuser',
'password' => 'dbpass',
'dbname' => 'dbname'
));

$username = $db->fetchOne("
SELECT username
FROM xf_user
WHERE user_id = " . $userId . "
");

$mcdb->query("
UPDATE iConomy
SET Balance = Balance + 3000
WHERE username = '" . addslashes($username) . "'
");

return $retval;
}
}
Author
Josh
Downloads
0
First release
Last update
Rating
0.00 star(s) 0 ratings

Share this resource

Dear User!

We found that you are blocking the display of ads on our site.

It looks like you're using an ad blocker. That's okay. Who doesn't?

But without advertising-income, we can't keep making this site awesome.

Thank you for understanding!