From 4ca4b08aac64aaa2f7a3c38209b33683f4d41287 Mon Sep 17 00:00:00 2001
From: Retro_Guy <retro.guy@rocksolidbbs.com>
Date: Wed, 18 Dec 2024 09:02:00 -0700
Subject: [PATCH] Add feature to allow email to admin on new account creation.

---
 Rocksolid_Light/common/register.php            | 9 +++++++++
 Rocksolid_Light/rslight/overrides.inc.php.dist | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/Rocksolid_Light/common/register.php b/Rocksolid_Light/common/register.php
index b4930ed..5c6a1b1 100644
--- a/Rocksolid_Light/common/register.php
+++ b/Rocksolid_Light/common/register.php
@@ -748,6 +748,15 @@ function create_new($username, $password, $user_email)
     }
     echo '<br ><a href="' . $CONFIG['default_content'] . '">Back</a>';
     echo '</center>';
+
+    $mail_subject = '[' . $_SERVER['HTTP_HOST'] . '] New User Registration ';
+    $mail_body = 'New user registration on ' . $_SERVER['HTTP_HOST'] . "\n\nUsername: . " . $username . "\n\nEmail: " . $user_email;
+    if(isset($OVERRIDES['send_admin_registration_email']) && $OVERRIDES['send_admin_registration_email'] == true) {
+        send_internet_email($mail_subject, $mail_body);
+    } else {
+        send_admin_message('admin', 'admin', $mail_subject, $mail_body . "\n");
+    }
+    
 }
 
 function make_key($username)
diff --git a/Rocksolid_Light/rslight/overrides.inc.php.dist b/Rocksolid_Light/rslight/overrides.inc.php.dist
index 51b4e1e..b2a3eb0 100644
--- a/Rocksolid_Light/rslight/overrides.inc.php.dist
+++ b/Rocksolid_Light/rslight/overrides.inc.php.dist
@@ -122,6 +122,10 @@ return [
     // Default is false
     'send_admin_debug_messages' => false,
 
+    // Send Admin New Registration Emails
+    // Default is false
+    'send_admin_registration_email' => false,
+
     // Disable toggle to send interBBS Mail to email
     'disable_mail_to_email' => true,