function admin_send_new_user_notification($new_user_uid) { if (!($db = db::get())) { return false; } if (!is_numeric($new_user_uid)) { return false; } $user_perm_admin_tools = USER_PERM_ADMIN_TOOLS; $notification_success = true; $sql = "SELECT DISTINCT GROUP_USERS.UID, BIT_OR(GROUP_PERMS.PERM) AS PERM "; $sql .= "FROM GROUP_USERS INNER JOIN GROUPS ON (GROUPS.GID = GROUP_USERS.GID) "; $sql .= "INNER JOIN GROUP_PERMS ON (GROUP_PERMS.GID = GROUPS.GID) "; $sql .= "INNER JOIN USER ON (USER.UID = GROUP_USERS.UID) "; $sql .= "WHERE GROUP_PERMS.FORUM = 0 GROUP BY GROUP_USERS.UID "; $sql .= "HAVING PERM & {$user_perm_admin_tools} > 0"; if (!($result = $db->query($sql))) { return false; } while (list($admin_uid) = $result->fetch_row()) { if (!email_send_new_user_notification($admin_uid, $new_user_uid)) { $notification_success = false; } } return $notification_success; }
function admin_send_new_user_notification($new_user_uid) { if (!($db = db::get())) { return false; } if (!is_numeric($new_user_uid)) { return false; } $user_perm_admin_tools = USER_PERM_ADMIN_TOOLS; $notification_success = false; $sql = "SELECT DISTINCT USER_PERM.UID, BIT_OR(USER_PERM.PERM) AS PERM "; $sql .= "FROM USER INNER JOIN USER_PERM ON (USER_PERM.UID = USER.UID) "; $sql .= "WHERE USER_PERM.FORUM = 0 GROUP BY USER.UID "; $sql .= "HAVING PERM & {$user_perm_admin_tools} > 0"; if (!($result = $db->query($sql))) { return false; } while (($admin_data = $result->fetch_assoc()) !== null) { if (email_send_new_user_notification($admin_data['UID'], $new_user_uid)) { $notification_success = true; } } return $notification_success; }