Question Does anyone have an idea on how to use the PHP callback function?

Status
Not open for further replies.

randydrew6

Customer
I want to update an external database when a certain item is purchased with points, I know I can probably achieve this with the item's callback function but how exactly does one go about using that? Xenforo 1.5.4 btw
 
The location is determined by what you enter there. In XF1, entering f.ex. DBTech_Shop_Something_Else would mean /library/DBTech/Shop/Something/Else.php with the class name Else.
 
Sorry I am still kind of confused, would you give me an example of what it would look like? Would your example have this inputted?

download.webp
 
No. The first of the two fields is the class name, the second field is the method name.

DBTech_Shop_Something_Else :: someMethod

Would mean a method named someMethod in the aforementioned class file, and it must be static.
 
Im sorry I been trying for hours to figure this out, maybe I'm missing something. I set the callback as "DBTech_Shop_Memberships_monthly::OneMonthSupporter" and I created a file under the location "/library/DBTech/Shop/Memberships/monthly.php" in that file I have this:


Code:
<?php
class monthly
{
    static function OneMonthSupporter(array &$buyer, $purchaseId, array $purchaseInfo)
    {
        $userUpgradeModel = XenForo_Model::create('XenForo_Model_UserUpgrade');
        $userUpgradeModel->upgradeUser(4, getUserUpgradeById(8), true, null);
    }
}
?>

But it seems like it never actually runs through it, I notice if I put an error in it then it won't load but if I just put that it doesn't upgrade user 4 to upgrade 8. I've tried manually setting up the array and still nothing
 
No. The first of the two fields is the class name, the second field is the method name.

DBTech_Shop_Something_Else :: someMethod

Would mean a method named someMethod in the aforementioned class file, and it must be static.
Do you have any idea as to why it isn't upgrading the user with id 4?
 
My guess would be that getUserUpgradeById is not a global function and it's not being called correctly.
 
Hello @randydrew6,

We hope your ticket regarding DragonByte Shop has been addressed to your satisfaction. This ticket has now been scheduled to be closed.

If your ticket has not been resolved, you can reply to this thread at any point in the next 7 days in order to reopen the ticket, afterwards this thread will be closed.

Please do not reply to this thread if your ticket has been resolved.

Thank you.


- DragonByte Technologies, Ltd.
 
Hello @randydrew6,

As we have not heard back from you, your ticket regarding DragonByte Shop has now been closed.

If your ticket has not been resolved, please feel free to start a new support ticket and link back to this ticket.

If you have time, please leave a review on XenForo.com's Resource Manager.

Thank you.


- DragonByte Technologies, Ltd.
 
Status
Not open for further replies.

DragonByte Shop

XenForo 1.5.3+ XenForo 2.0.x XenForo 2.1.x XenForo 2.2.x XenForo 2.3.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
3,453
Customer rating
5.00 star(s) 3 ratings
Back
Top