XF 2.2 Prevent email on user upgrade

stromb0li

Active member
I am trying to upgrade a user programmatically and each time I do so, the payment_received email is sent out to the upgraded account.

Is there a way to suppress these? I tried $upgradeService->setSendAlert(false);, but setSendAlert doesn't seem to be valid.

PHP:
  $upgradeService = $app->service('XF:User\Upgrade', $userUpgrade, $username);
  $upgradeService->setEndDate($timestamp);
  $upgradeService->upgrade();

Thank you!
 
I believe these emails are only sent out when upgrades are ran through the payment system. \XF\Payment\AbstractProvider::completeTransaction calls \XF\Purchasable\AbstractPurchasable::sendPaymentReceipt, but I don't think the upgrade service calls either of those methods directly so I'm not sure why that would be the case.
 
Top Bottom