- $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
- SEND_EMAIL($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+ $message = loadEmailTemplate('member_rallye_notify', $content, $userid);
+ sendEmail($userid, getMaskedMessage('RALLYE_MEMBER_NOTIFY', $title), $message);
+ } // END - if
+
+ // Check if line is already included...
+ $result = SQL_QUERY_ESC("SELECT
+ `id`
+FROM
+ `{?_MYSQL_PREFIX?}_rallye_users`
+WHERE
+ `rallye_id`=%s AND
+ `userid`=%s
+LIMIT 1",
+ array(
+ bigintval($id),
+ bigintval($userid)
+ ), __FUNCTION__, __LINE__);
+
+ // Is this user added?
+ if (SQL_NUMROWS($result) < 1) {
+ // Add userid and his ref count to table
+ SQL_QUERY_ESC("INSERT INTO
+ `{?_MYSQL_PREFIX?}_rallye_users`
+(`rallye_id`, `userid`, `refs`)
+ VALUES
+(%s,%s,0)",
+ array(
+ bigintval($id),
+ bigintval($userid)
+ ), __FUNCTION__, __LINE__);