XF 2.2 Run query on user downgrade

FoxSecrets

Active member
I need to run a query on user downgrade, so I set class extension XF\Cron\CleanUp ~ My\Addon\XF\Cron\CleanUp

The function runUserDowngrade runs under XF class not what I've set.

Code:
namespace My\Addon\XF\Cron;

class CleanUp extends XFCP_CleanUp {

    public static function runUserDowngrade()
    {
        // RUN QUERY
       
        $userUpgradeRepo = \XF::repository('XF:UserUpgrade');
        $userUpgradeRepo->downgradeExpiredUpgrades();
    }

What's wrong? How's the process to run query on user downgrade in 2.2 XF version?
 
Last edited:
Got it working. I extended the wrong class.

It has to be XF\Repository\UserUpgrade ~ My\Addon\XF\Repository\UserUpgrade , not CleanUp.
 
Back
Top Bottom