I have an email template + registration rule working fine.
However, I would prefer the coupon code to be visible to the registrant immediately upon completion of registration rather than emailing it to them.
Is this possible?
Thanks
<?php
$rule_id = 17;
$user_id = JFactory::getUser()->id;
$db = JFactory::getDBO();
$coupon_code = $db->setQuery( '
SELECT c.coupon_code
FROM #__awocoupon c
JOIN #__aworewards r ON r.coupon_id=c.id AND r.credit_type="awocoupon"
WHERE r.rule_id=' . (int) $rule_id . ' AND r.user_id=' . (int) $user_id . '
' );
echo $coupon_code;
?>