diff --git a/wrenchboard/src/shared_tool/email.cc b/wrenchboard/src/shared_tool/email.cc index 6204a2c4..3a799151 100644 --- a/wrenchboard/src/shared_tool/email.cc +++ b/wrenchboard/src/shared_tool/email.cc @@ -222,6 +222,9 @@ long cron_email(long mailtype, CVars in, CVars &out) { } return 0; } + + + long account_email(long mailtype, CVars in, CVars &out) { //REQ_LONG( in, "member_id", 1, -1 ); @@ -231,12 +234,13 @@ long account_email(long mailtype, CVars in, CVars &out) { CGIList * inv_list = new CGIList(&form, "inv_items"); char listing_items[1024]; const PGresult *res; - + bool exclude_email = true; char * server_name = getenv("SERVER_NAME"); form.LetStr("server_name", "https://dashboard.wrenchboard.com"); form.LetStr("site_name", "WrenchBoard"); form.LetStr("site_trade_name", "Connecting Opportunities"); + try { switch (mailtype) { @@ -272,7 +276,14 @@ long account_email(long mailtype, CVars in, CVars &out) { case ACCOUNT_LOGIN_ALERT: REQ_LONG(in, "member_id", 1, -1); - if (load_db_record(x, "SELECT *,email as email2,to_char(last_login, 'Day Mon dd, yyyy HH:MI AM') AS last_login2 FROM members WHERE id = %lu ", in["member_id"].Long())) { + + // testing exclusion first + res = pgsql_query("SELECT * FROM members_settings WHERE member_id = %lu AND pref_id='S0001' AND status=100", in["member_id"].Long()); + if (res != NULL && pgsql_num_rows(res) > 0) { + exclude_email = false; + } + + if (!exclude_email && load_db_record(x, "SELECT *,email as email2,to_char(last_login, 'Day Mon dd, yyyy HH:MI AM') AS last_login2 FROM members WHERE id = %lu ", in["member_id"].Long())) { in["server_name"] = "https://dashboard.wrenchboard.com"; @@ -303,7 +314,7 @@ long account_email(long mailtype, CVars in, CVars &out) { CVars rec; map_to_cvars(f, rec); - sprintf(listing_items, "%s - %s
Duration:%s Day(s)", in["color"].c_str(), in["server_name"].c_str(), rec["offer_code"].c_str(), rec["title"].c_str(), rec["description"].c_str(), rec["timeline_days"].c_str()); + sprintf(listing_items, "%s - %s
Duration:%s Day(s)", in["color"].c_str(), in["server_name"].c_str(), rec["offer_code"].c_str(), rec["title"].c_str(), rec["description"].c_str(), rec["timeline_days"].c_str()); inv_list->LetStr("pin", listing_items); inv_list->CloseElement(); //