Hello terabyte,
A very big thanks to your help and prompt reply. I was able to do the changes as per your suggestions. Here is my final code and its working when user is adding Topic at my local machine.
protected function processAfterCreate($comment, $values)
{
# Remove prefix
$previousPrefix = \IPS\Db::i()->prefix;
\IPS\Db::i()->prefix = '';
$user_group_id = \IPS\Member::loggedIn()->member_group_id;
if ($user_group_id == 3 || $user_group_id == 4 || $user_group_id == 7 || $user_group_id == 😎 //bronze // || $user_group_id == 4)
{
# no need to check for double points
$assign_point = 1;
}
if ($assign_point == 1) {
$reward_mailing_points = 250;
}
$result = \IPS\Db::i()->select('*', 'plug_mailing_master', array('user_id=?', \IPS\Member::loggedIn()->member_id));
foreach ($result as $row) {
$credit_balance = $reward_mailing_points + intval($row['credit_balance']);
}
# Update database with new $cc value
\IPS\Db::i()->update('plug_mailing_master', array('credit_balance' => $credit_balance), array('user_id=?', \IPS\Member::loggedIn()->member_id));
# Reset prefix
\IPS\Db::i()->prefix = $previousPrefix;
return parent::processAfterCreate($comment, $values);
}