diff --git a/includes/tab-ai.php b/includes/tab-ai.php
index d73c922..43641c2 100644
--- a/includes/tab-ai.php
+++ b/includes/tab-ai.php
@@ -34,14 +34,17 @@ public function content(){
}
public function process_post() {
- // Process Chat Model Form
+ // Verify nonces
$ai_chat_nonce_verified = isset( $_POST['ai_chat_nonce'] )
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ai_chat_nonce'] ) ), 'ai_chat' );
$ai_transcript_nonce_verified = isset( $_POST['ai_transcript_nonce'] )
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ai_transcript_nonce'] ) ), 'ai_transcript' );
- if ( !$ai_chat_nonce_verified && !$ai_transcript_nonce_verified ) {
+ $ai_features_nonce_verified = isset( $_POST['ai_features_nonce'] )
+ && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ai_features_nonce'] ) ), 'ai_features' );
+
+ if ( !$ai_chat_nonce_verified && !$ai_transcript_nonce_verified && !$ai_features_nonce_verified ) {
return [
'is_update' => false,
'updated' => false
@@ -97,6 +100,28 @@ public function process_post() {
];
}
+ // Process Enabled Features Form
+ if ( $ai_features_nonce_verified ) {
+ $post_vars = dt_recursive_sanitize_array( $_POST );
+
+ // Get all modules
+ $modules = Disciple_Tools_AI_API::list_modules();
+
+ // Build network module states array
+ $network_module_states = [];
+ foreach ( $modules as $module ) {
+ $network_module_states[ $module['id'] ] = isset( $post_vars[ $module['id'] ] ) ? 1 : 0;
+ }
+
+ // Save network-level module states
+ update_site_option( 'DT_AI_network_modules', $network_module_states );
+
+ return [
+ 'is_update' => true,
+ 'updated' => true
+ ];
+ }
+
return false;
}
@@ -303,6 +328,55 @@ public function list_keys( $processed ){
+
+
+