onafterinsert You are using transaction macros with a connection that is not transact

Hi all,
my problem is this error showed when i save the add_users form, pre-build from security module. On the “onafterinsert” event is this code:

"$sql = “SELECT
email
FROM
sec_users
WHERE
priv_admin = ‘Y’”;

sc_lookup(rs,$sql);

$emails_admin = array();
if({rs} !== FALSE && count({rs}) != 0)
{
foreach({rs} as $value)
$emails_admin[] = $value[0];
}
$emails_admin = implode(’, ', $emails_admin);

/**

  • Send a simple email
    */

// Email parameters
$mail_smtp_server = ‘smtp.gmail.com’; // SMTP server name or IP address
$mail_smtp_user = ‘support@company.us’; // SMTP user name
$mail_smtp_pass = ‘support’; // SMTP password
$mail_from = ‘support@company.us’; // From email
$mail_to = $emails_admin; // To email

$mail_message = sprintf({lang_new_user_sign_in}, {name}, {email});

$mail_subject = {lang_subject_mail};
$mail_format = ‘H’; // Message format: (T)ext or (H)tml

// Send email
sc_mail_send($mail_smtp_server,
$mail_smtp_user,
$mail_smtp_pass,
$mail_from,
$mail_to,
$mail_subject,
$mail_message,
$mail_format,
‘’,’’, ‘587’);

sc_log_add(“New user”, {lang_send_mail_admin});
sc_commit_trans();
sc_redir(“aps_Login”);"

…but it displays this message: “You are using transaction macros with a connection that is not transactional”
and it doesn’t do the adding.
What should i change??
All the best
Mirela

Hello Mirela,

Set your connection to transactional on Edit Connection.

regards,
Bernhard Bernsmann