PluginProbe
wpForo Forum / 3.1.2
wpForo Forum v3.1.2
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / tools / generate-complete-knowledge.php

generate-complete-knowledge.php in wpForo Forum 3.1.2, at tools/generate-complete-knowledge.php

1,601 lines 74.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 #!/usr/bin/env php
2 <?php
3 /**
4 * wpForo Complete Knowledge Generator
5 *
6 * Generates comprehensive expert knowledge including:
7 * 1. All settings with behavioral effects
8 * 2. Feature documentation with how things work
9 * 3. User scenarios and troubleshooting
10 * 4. Interconnections between settings
11 * 5. Incremental update support
12 *
13 * Usage: php generate-complete-knowledge.php [output-dir]
14 */
15
16 $WPFORO_DIR = dirname(__DIR__);
17 $OUTPUT_DIR = $argv[1] ?? $WPFORO_DIR . '/docs/expert-knowledge';
18
19 if (!is_dir($OUTPUT_DIR)) mkdir($OUTPUT_DIR, 0755, true);
20 if (!is_dir("$OUTPUT_DIR/settings")) mkdir("$OUTPUT_DIR/settings", 0755, true);
21 if (!is_dir("$OUTPUT_DIR/features")) mkdir("$OUTPUT_DIR/features", 0755, true);
22 if (!is_dir("$OUTPUT_DIR/troubleshooting")) mkdir("$OUTPUT_DIR/troubleshooting", 0755, true);
23 if (!is_dir("$OUTPUT_DIR/scenarios")) mkdir("$OUTPUT_DIR/scenarios", 0755, true);
24 if (!is_dir("$OUTPUT_DIR/for-indexing")) mkdir("$OUTPUT_DIR/for-indexing", 0755, true);
25
26 echo "wpForo Complete Knowledge Generator\n";
27 echo "====================================\n\n";
28
29 // ============================================================================
30 // PART 1: EXTRACT ALL SETTINGS WITH BEHAVIORAL CONTEXT
31 // ============================================================================
32
33 echo "Extracting settings with behavioral context...\n";
34
35 function extractSettings($wpforoDir) {
36 $settingsFile = "$wpforoDir/classes/Settings.php";
37 $content = file_get_contents($settingsFile);
38
39 $settings = [];
40 $currentCategory = '';
41
42 // Find all setting categories
43 preg_match_all('/\'(\w+)\'\s*=>\s*\[\s*"title"\s*=>\s*[^,]+,/', $content, $categories);
44
45 // Extract individual settings with their metadata
46 preg_match_all('/
47 "([a-z_]+)"\s*=>\s*\[\s*
48 "type"\s*=>\s*"(\w+)"[^]]*
49 "label"\s*=>\s*(?:esc_html__\(\s*"([^"]+)"|"([^"]+)")[^]]*
50 (?:"description"\s*=>\s*(?:esc_html__\(\s*"([^"]*)"|"([^"]*)")[^]]*)?
51 (?:"description_original"\s*=>\s*"([^"]*)")[^]]*
52 (?:"docurl"\s*=>\s*"([^"]*)"|)
53 /xms', $content, $matches, PREG_SET_ORDER);
54
55 foreach ($matches as $match) {
56 $name = $match[1];
57 $type = $match[2];
58 $label = $match[3] ?: ($match[4] ?? '');
59 $description = $match[5] ?: ($match[6] ?? ($match[7] ?? ''));
60 $docurl = $match[8] ?? '';
61
62 $settings[$name] = [
63 'name' => $name,
64 'type' => $type,
65 'label' => $label,
66 'description' => $description,
67 'docurl' => $docurl,
68 ];
69 }
70
71 return $settings;
72 }
73
74 $settings = extractSettings($WPFORO_DIR);
75 echo " Found " . count($settings) . " settings\n";
76
77 // ============================================================================
78 // PART 2: DEFINE BEHAVIORAL KNOWLEDGE (Manual Expert Content)
79 // ============================================================================
80
81 // This is the BEHAVIORAL knowledge that code analysis cannot capture
82 // This should be maintained by support team based on user questions
83
84 $behavioralKnowledge = [
85 // ========== MEMBERS & PROFILES ==========
86 'member_threshold_posts' => [
87 'category' => 'members',
88 'setting' => 'threshold_posts',
89 'behavior' => 'Controls how many approved posts a user needs before being considered a "trusted" member. Until this threshold is reached, users are treated as "new users" with restricted privileges.',
90 'affects' => [
91 'Profile editing access',
92 'Signature display',
93 'Avatar upload',
94 'Link posting in content',
95 'Auto-moderation bypass',
96 ],
97 'common_issues' => [
98 'User cannot edit profile' => 'User has fewer approved posts than threshold_posts setting',
99 'Signature not showing' => 'User needs more approved posts OR signature feature disabled',
100 'Links being stripped' => 'User is "new" and link stripping is enabled for new users',
101 ],
102 'related_settings' => ['new_user_max_posts', 'link_stripping_newuser'],
103 'admin_path' => 'Dashboard > wpForo > Settings > Members > General',
104 ],
105
106 'new_user_unapprove' => [
107 'category' => 'members',
108 'setting' => 'new_user_unapprove',
109 'behavior' => 'When enabled, posts from "new users" (those below threshold_posts) automatically go to moderation queue instead of being published immediately.',
110 'affects' => [
111 'Topic and reply publishing',
112 'Moderation queue volume',
113 'User experience for new members',
114 ],
115 'common_issues' => [
116 'New user post not visible' => 'Post is in moderation queue waiting for approval',
117 'Too many posts in moderation' => 'Consider increasing threshold or disabling for verified emails',
118 ],
119 'related_settings' => ['threshold_posts', 'new_user_unapprove_if_link'],
120 'admin_path' => 'Dashboard > wpForo > Settings > Members > General',
121 ],
122
123 'can_edit_profile' => [
124 'category' => 'members',
125 'setting' => 'can_edit_profile',
126 'behavior' => 'Controls whether users can edit their own profile. When disabled globally, even "trusted" users cannot edit profiles.',
127 'common_issues' => [
128 'Edit Profile tab missing' => 'Check: 1) can_edit_profile enabled, 2) user has enough approved posts (threshold_posts), 3) usergroup has profile edit permission',
129 ],
130 'related_settings' => ['threshold_posts'],
131 'admin_path' => 'Dashboard > wpForo > Settings > Profiles > Options',
132 ],
133
134 // ========== PERMISSIONS & ACCESS ==========
135 'usergroup_permissions' => [
136 'category' => 'permissions',
137 'feature' => 'usergroup_system',
138 'behavior' => 'wpForo uses its own permission system separate from WordPress roles. Each usergroup has forum-specific permissions (can view forum, can create topic, can reply, etc.).',
139 'key_concepts' => [
140 'Usergroups' => 'Define what users CAN do (capabilities)',
141 'Forum Access' => 'Define WHERE users can do things (per-forum)',
142 'Permission Codes' => 'vf=view forum, vt=view topics, ct=create topic, cr=create reply, et=edit topic, er=edit reply, l=like, s=subscribe, au=auto-unapprove bypass',
143 ],
144 'common_issues' => [
145 'User cannot post in forum' => 'Check usergroup has "ct" or "cr" permission for that forum',
146 'User cannot see forum' => 'Check usergroup has "vf" permission for that forum',
147 'Private forum visible to wrong users' => 'Check Forum Access settings in Forum edit page',
148 ],
149 'admin_path' => 'Dashboard > wpForo > Usergroups (for capabilities) AND Forums > Edit Forum > Access (for per-forum)',
150 ],
151
152 // ========== TOPICS & POSTS ==========
153 'topic_status' => [
154 'category' => 'topics',
155 'feature' => 'topic_status_system',
156 'behavior' => 'Topics have multiple status flags: approved/unapproved (status), open/closed, solved/unsolved, private/public. These affect visibility and interaction.',
157 'status_values' => [
158 'status = 0' => 'Approved - visible to all with access',
159 'status = 1' => 'Unapproved - only visible to author, mods, admins',
160 'closed = 1' => 'No new replies allowed',
161 'private = 1' => 'Only visible to author and those with "vp" permission',
162 'solved = 1' => 'Marked as answered (Q&A layout)',
163 ],
164 'common_issues' => [
165 'Topic not showing after creation' => '1) Check status (might be unapproved), 2) Check private flag, 3) Clear cache',
166 'Cannot reply to topic' => 'Topic might be closed OR user lacks "cr" permission',
167 ],
168 ],
169
170 'post_moderation' => [
171 'category' => 'topics',
172 'feature' => 'moderation_system',
173 'behavior' => 'Posts can go to moderation queue based on: new user status, link detection, spam detection, or AI moderation (if enabled). Moderators see unapproved posts with "Approve" button.',
174 'triggers' => [
175 'new_user_unapprove = true' => 'New users (below threshold) auto-moderated',
176 'new_user_unapprove_if_link = true' => 'New user posts with links auto-moderated',
177 'AI Moderation' => 'Content flagged by AI goes to moderation',
178 'Spam detection' => 'Certain patterns trigger moderation',
179 ],
180 'admin_path' => 'Dashboard > wpForo > Moderation (to see queue)',
181 ],
182
183 // ========== SUBSCRIPTIONS & EMAIL ==========
184 'email_notifications' => [
185 'category' => 'email',
186 'feature' => 'subscription_system',
187 'behavior' => 'Users can subscribe to forums or topics to receive email notifications. Emails are sent via WordPress wp_mail() which respects SMTP plugins.',
188 'subscription_types' => [
189 'All Forums' => 'Email for any new topic in any forum',
190 'Forum' => 'Email for new topics in specific forum',
191 'Topic' => 'Email for new replies to specific topic',
192 ],
193 'common_issues' => [
194 'Not receiving subscription emails' => '1) Check spam folder, 2) Check user subscriptions exist, 3) Check SMTP working, 4) Check async queue if enabled',
195 'Duplicate emails' => 'User might be subscribed at multiple levels (forum + topic)',
196 'Email delayed' => 'Async email queue enabled - check Tools > Email Queue',
197 ],
198 'related_settings' => ['async_notifications', 'new_topic_notify', 'new_reply_notify'],
199 'admin_path' => 'Dashboard > wpForo > Settings > Emails',
200 ],
201
202 'async_notifications' => [
203 'category' => 'email',
204 'setting' => 'async_notifications',
205 'behavior' => 'When enabled, subscription emails are queued and sent in background via WP Cron instead of immediately. Prevents slow page loads when posting to topics with many subscribers.',
206 'common_issues' => [
207 'Emails not sending' => 'Check Tools > Email Queue - Cron might be stalled. Emails fall back to sync if cron unhealthy.',
208 'Emails delayed' => 'Normal with async - processed every 30 seconds',
209 ],
210 'admin_path' => 'Dashboard > wpForo > Settings > Emails + Tools > Email Queue',
211 ],
212
213 // ========== SEARCH & PERFORMANCE ==========
214 'search_behavior' => [
215 'category' => 'search',
216 'feature' => 'search_system',
217 'behavior' => 'wpForo has two search modes: Legacy (MySQL LIKE/FULLTEXT) and AI Semantic Search (requires AI subscription). Legacy search is keyword-based, AI search understands meaning.',
218 'modes' => [
219 'Legacy Search' => 'Uses MySQL queries, exact keyword matching, fast but less accurate',
220 'AI Semantic Search' => 'Uses vector embeddings, understands meaning, finds related content',
221 ],
222 'common_issues' => [
223 'Search returns no results' => 'Check: 1) Content is indexed, 2) User has access to forums containing results, 3) Search index not corrupted',
224 'Search slow' => 'Large forums may need MySQL optimization or switch to AI search',
225 ],
226 'related_settings' => ['search_max_results', 'ai settings'],
227 ],
228
229 // ========== LAYOUTS & DISPLAY ==========
230 'forum_layouts' => [
231 'category' => 'layouts',
232 'feature' => 'layout_system',
233 'behavior' => 'wpForo has 5 forum layouts that change how topics and posts are displayed. Layout is set per-forum, not globally. Each layout has unique template files and settings.',
234 'layouts' => [
235 'Extended (Layout 1)' => 'Info-rich layout with topic/post previews on forum listing. Best for general discussions. Shows recent topics expanded.',
236 'Simplified (Layout 2)' => 'Clean minimal layout, compact topic list. Good for high-volume forums. Has Add Topic button toggle.',
237 'Q&A (Layout 3)' => 'Question/Answer format with voting, best answer marking, and comments. Uses different terminology: Questions, Answers, Comments.',
238 'Threaded (Layout 4)' => 'Nested reply tree structure like Reddit. Configurable nesting depth (default 5 levels). Shows conversation threads.',
239 'Boxed (Layout 5)' => 'Modern card-based design with cover images. NEW in 2026 theme. Clean visual appearance with stats display.',
240 ],
241 'layout_settings' => [
242 'Extended' => 'intro_topics_toggle, intro_topics_count (3), intro_topics_length (45), intro_posts_toggle, intro_posts_count (4)',
243 'Simplified' => 'add_topic_button toggle',
244 'Q&A' => 'posts_per_page (15), comments_limit (3), answer_editor_display, first_post_reply toggle',
245 'Threaded' => 'nesting_level (5), posts_per_page (5), display_subforums, filter_buttons toggle',
246 'Boxed' => 'Inherits simplified settings, uses cover images',
247 ],
248 'common_issues' => [
249 'Wrong layout showing' => 'Check forum settings - layout is per-forum, not global. Dashboard > Forums > Edit Forum > Layout',
250 'Threaded replies not nesting' => 'Check layout_threaded_nesting_level setting (Settings > Forums)',
251 'Q&A voting not working' => 'Ensure layout is set to Q&A (3) and user has "v" (vote) permission',
252 'Comments not showing in Q&A' => 'Check layout_qa_comments_limit_count setting',
253 ],
254 'admin_path' => 'Dashboard > Forums > Edit Forum > Layout dropdown',
255 ],
256
257 // ========== BOARDS (MULTI-BOARD SYSTEM) ==========
258 'boards_system' => [
259 'category' => 'boards',
260 'feature' => 'multi_board_system',
261 'behavior' => 'wpForo Boards allow multiple separate forum instances within one WordPress installation. Each board has its own forums, topics, posts, and can have separate settings. Great for multi-language forums or different communities.',
262 'key_concepts' => [
263 'Board' => 'A complete forum instance with its own content and URL slug',
264 'Default Board (ID 0)' => 'The primary board, uses standard table names (wp_wpforo_forums)',
265 'Additional Boards' => 'Use prefixed tables (wp_wpforo_1_forums, wp_wpforo_2_forums)',
266 'Standalone Mode' => 'Makes one board replace the entire WordPress frontend',
267 ],
268 'board_specific_data' => [
269 'forums, topics, posts' => 'Completely separate per board',
270 'subscriptions, visits, reactions' => 'Separate per board',
271 'usergroups, profiles' => 'SHARED across all boards',
272 'settings' => 'Can be global or board-specific (override)',
273 ],
274 'common_issues' => [
275 'Content not showing' => 'Make sure you are viewing the correct board - check URL slug',
276 'Settings not saving for specific board' => 'Check if editing board-specific settings page (?page=wpforo-{boardid}-settings)',
277 'Users missing from board' => 'User profiles are shared - check forum permissions for that board',
278 ],
279 'admin_path' => 'Dashboard > wpForo > Boards',
280 ],
281
282 // ========== FORUMS MANAGEMENT ==========
283 'forums_management' => [
284 'category' => 'forums',
285 'feature' => 'forum_hierarchy',
286 'behavior' => 'Forums are organized in a hierarchy with Categories (parent) and Forums (children). Each forum can have its own layout, permissions, and access settings.',
287 'forum_types' => [
288 'Category' => 'Container for forums, cannot have topics directly. parentid=0',
289 'Forum' => 'Where topics are posted. Has parentid pointing to category',
290 'Subforum' => 'Forum nested under another forum',
291 ],
292 'forum_properties' => [
293 'layout' => 'Which of the 5 layouts to use (1-5)',
294 'permissions' => 'Per-usergroup access (maps groupid to access level)',
295 'status' => '0=open, 1=closed (no new topics)',
296 'is_cat' => '1=category, 0=forum',
297 'cover' => 'Cover image for Boxed layout',
298 ],
299 'common_issues' => [
300 'Forum not visible' => 'Check: 1) Forum status is open, 2) User has "vf" permission, 3) Cache cleared',
301 'Cannot create subforum' => 'Select parent forum when creating new forum',
302 'Forum order wrong' => 'Drag and drop forums in admin to reorder',
303 ],
304 'admin_path' => 'Dashboard > wpForo > Forums (drag-drop reordering)',
305 ],
306
307 // ========== AI FEATURES ==========
308 'ai_features' => [
309 'category' => 'ai',
310 'feature' => 'ai_system',
311 'behavior' => 'wpForo AI features require cloud subscription and include: Semantic Search, Topic Suggestions, Translation, Summarization, Content Moderation, and AI Chatbot.',
312 'features' => [
313 'Semantic Search' => 'Find content by meaning, not just keywords',
314 'Topic Suggestions' => 'Suggest similar topics before user posts',
315 'AI Moderation' => 'Auto-detect spam, toxic content, policy violations',
316 'AI Chatbot' => 'Answer user questions based on forum content',
317 'Translation' => 'Translate posts to other languages',
318 'Summarization' => 'Generate topic summaries',
319 ],
320 'requirements' => [
321 'Active gVectors AI subscription',
322 'Forum content indexed in cloud',
323 'Credits available',
324 ],
325 'common_issues' => [
326 'AI features not working' => 'Check: 1) Subscription active, 2) API connected, 3) Credits available, 4) Content indexed',
327 'Search not finding content' => 'Content needs to be indexed - check AI Content Indexing tab',
328 'Moderation not flagging' => 'Check moderation settings and thresholds',
329 ],
330 'admin_path' => 'Dashboard > wpForo > AI Features',
331 ],
332
333 'storage_mode' => [
334 'category' => 'ai',
335 'setting' => 'storage_mode',
336 'behavior' => 'Determines where AI embeddings are stored. Cloud mode stores in AWS S3, Local mode stores in WordPress database. Cloud is recommended for better performance and all features.',
337 'modes' => [
338 'Cloud (S3)' => 'Best performance, all features, requires subscription',
339 'Local (WordPress)' => 'Limited features, slower, works offline',
340 ],
341 'common_issues' => [
342 'Switching modes' => 'Requires re-indexing all content',
343 'Local mode slow' => 'SQLite queries slower than S3 Vectors - use cloud for large forums',
344 ],
345 ],
346
347 // ========== PERMISSIONS SYSTEM (DETAILED) ==========
348 'permission_codes' => [
349 'category' => 'permissions',
350 'feature' => 'permission_codes_reference',
351 'behavior' => 'wpForo uses two-tier permissions: Usergroup capabilities (what users CAN do) and Forum Access (WHERE they can do it). Each forum maps usergroups to access levels.',
352 'forum_permission_codes' => [
353 'vf' => 'View Forum - see forum in listing',
354 'enf' => 'Enter Forum - access forum page',
355 'vt' => 'View Topics - see topic list',
356 'ent' => 'Enter Topic - access topic page',
357 'vr' => 'View Replies - see posts in topic',
358 'ct' => 'Create Topic - post new topics',
359 'cr' => 'Create Reply - post replies',
360 'ocr' => 'Reply to Own Topic only',
361 'et' => 'Edit Any Topic - moderator level',
362 'er' => 'Edit Any Reply - moderator level',
363 'eot' => 'Edit Own Topic',
364 'eor' => 'Edit Own Reply',
365 'dt' => 'Delete Any Topic - moderator level',
366 'dr' => 'Delete Any Reply - moderator level',
367 'dot' => 'Delete Own Topic',
368 'dor' => 'Delete Own Reply',
369 'l' => 'Like - react to posts',
370 'v' => 'Vote - Q&A voting',
371 's' => 'Sticky - make topics sticky',
372 'p' => 'Private - set any topic private',
373 'op' => 'Own Private - set own topic private',
374 'au' => 'Auto-Unapprove bypass - skip moderation',
375 'vp' => 'View Private - see private topics',
376 'mt' => 'Move Topic - move between forums',
377 'cot' => 'Close Topic',
378 'sv' => 'Solved - mark any topic solved',
379 'osv' => 'Own Solved - mark own topic solved',
380 'tag' => 'Add Tags',
381 'sb' => 'Subscribe',
382 'r' => 'Report - report content',
383 'a' => 'Attach - upload files',
384 'va' => 'View Attachments',
385 'bm' => 'Ban Member',
386 'dm' => 'Delete Member',
387 ],
388 'access_levels' => [
389 'no_access' => 'Cannot see or interact with forum at all',
390 'read_only' => 'Can view but not post (default for Guests)',
391 'standard' => 'Can view, post, edit own content (default for Registered)',
392 'moderator' => 'Can edit/delete any content, approve posts',
393 'full' => 'All permissions enabled (default for Admin)',
394 ],
395 'common_issues' => [
396 'User cannot see forum' => 'Check usergroup has "vf" and "enf" for that forum',
397 'User cannot post' => 'Check usergroup has "ct" (topics) or "cr" (replies) for forum',
398 'Moderator cannot approve' => 'Check usergroup has "au" permission',
399 'Cannot edit own post' => 'Check "eot"/"eor" AND check edit time limit in Settings > Posting',
400 ],
401 'admin_path' => 'Dashboard > wpForo > Usergroups (capabilities) + Forums > Edit > Access (per-forum)',
402 ],
403
404 'default_usergroups' => [
405 'category' => 'permissions',
406 'feature' => 'default_usergroups',
407 'behavior' => 'wpForo has 5 default usergroups that map to WordPress roles. Groups 1,2,4 are protected (cannot be deleted). Users can have primary + secondary groups.',
408 'usergroups' => [
409 'Admin (ID 1)' => 'Maps to WP Administrator. Full access. Protected.',
410 'Moderator (ID 2)' => 'Maps to WP Editor. Can moderate content. Protected.',
411 'Registered (ID 3)' => 'Maps to WP Subscriber. Standard posting rights. Can be secondary.',
412 'Guest (ID 4)' => 'Non-logged-in users. Read-only by default. Protected.',
413 'Customer (ID 5)' => 'Maps to WP Customer role (WooCommerce). Can be secondary.',
414 ],
415 'secondary_groups' => 'Users can belong to multiple groups. Permissions are cumulative - if ANY group grants permission, user has it.',
416 'common_issues' => [
417 'New user has wrong permissions' => 'Check role-to-usergroup mapping in Usergroups settings',
418 'WooCommerce customer cannot post' => 'Check Customer usergroup has posting permissions',
419 ],
420 'admin_path' => 'Dashboard > wpForo > Usergroups',
421 ],
422
423 // ========== TOOLS ==========
424 'tools_debug' => [
425 'category' => 'tools',
426 'feature' => 'debug_tools',
427 'behavior' => 'Debug tab shows system information, user data viewer, and error logs. Use when troubleshooting installation or permission issues.',
428 'features' => [
429 'User Data Viewer' => 'See any member profile, user meta, cookies',
430 'Server Information' => 'PHP version, MySQL, server software, extensions',
431 'Error & Issues' => 'Display error logs and system recommendations',
432 ],
433 'admin_path' => 'Dashboard > wpForo > Tools > Debug',
434 ],
435
436 'tools_database' => [
437 'category' => 'tools',
438 'feature' => 'database_tools',
439 'behavior' => 'Database Tables tab shows full schema, detects problems, and can repair tables. Use after updates or when experiencing data issues.',
440 'features' => [
441 'Schema Display' => 'All tables with columns, types, indexes',
442 'Problem Detection' => 'Find missing fields, keys, or tables',
443 'Repair' => 'Generate and run SQL to fix issues',
444 ],
445 'common_issues' => [
446 'Missing table after update' => 'Run database repair from Tools > Database Tables',
447 'Index errors' => 'Check for missing keys and repair',
448 ],
449 'admin_path' => 'Dashboard > wpForo > Tools > Database Tables',
450 ],
451
452 'tools_email_queue' => [
453 'category' => 'tools',
454 'feature' => 'email_queue_tools',
455 'behavior' => 'Email Queue tab shows async email status, pending/failed/sent emails, and cron health. Essential for debugging notification issues.',
456 'features' => [
457 'Queue Statistics' => 'Pending, failed, sent today, total counts',
458 'Cron Status' => 'Shows if WP Cron is healthy or stalled',
459 'Email List' => 'Search/filter emails, retry failed, delete stuck',
460 'Process Now' => 'Manually trigger queue processing',
461 ],
462 'common_issues' => [
463 'Emails stuck in queue' => 'Check Cron Status - if stalled, emails fall back to sync mode',
464 'Failed emails' => 'Click retry or check error message for SMTP issues',
465 ],
466 'admin_path' => 'Dashboard > wpForo > Tools > Email Queue',
467 ],
468
469 // ========== CACHE SYSTEM ==========
470 'cache_system' => [
471 'category' => 'cache',
472 'feature' => 'wpforo_cache',
473 'behavior' => 'wpForo uses file-based caching for forums, topics, posts, avatars, and more. Cache improves performance but needs clearing after changes.',
474 'cache_types' => [
475 'Forum cache' => 'Forum listing pages',
476 'Topic cache' => 'Topic lists within forums',
477 'Post cache' => 'Individual post content',
478 'Item caches' => 'Individual objects (forum, topic, post, avatar, reaction, URL)',
479 'RAM cache' => 'In-memory cache for single request',
480 ],
481 'auto_invalidation' => [
482 'New topic/post' => 'Forum and topic caches cleared',
483 'Edit content' => 'Specific item cache cleared',
484 'Board change' => 'Full cache cleared for board',
485 'Settings change' => 'Relevant caches cleared',
486 ],
487 'common_issues' => [
488 'Old content showing' => 'Clear wpForo cache in Dashboard > wpForo > Dashboard > Clear Cache',
489 'Cache plugin conflicts' => 'Exclude /forum/ pages from external cache plugins',
490 'Memory issues' => 'Cache auto-cleans when >1000 files in directory',
491 ],
492 'admin_path' => 'Dashboard > wpForo > Dashboard (Clear Cache button) + Settings > Board > Cache',
493 ],
494
495 // ========== SEO SYSTEM ==========
496 'seo_system' => [
497 'category' => 'seo',
498 'feature' => 'seo_sitemaps',
499 'behavior' => 'wpForo generates XML sitemaps for forums, topics, and members. Sitemaps help search engines discover forum content.',
500 'sitemap_types' => [
501 'forum-sitemap.xml' => 'All public forums',
502 'topic-sitemap#.xml' => 'All public topics (paginated)',
503 'profile-sitemap#.xml' => 'All public member profiles',
504 'sitemap_index.xml' => 'Index of all sitemaps',
505 ],
506 'features' => [
507 'Auto Ping' => 'Notify Google/Bing when content changes',
508 'RFC 3986 URLs' => 'Properly encoded URLs',
509 'Permission Aware' => 'Only includes publicly visible content',
510 ],
511 'settings' => [
512 'topics_sitemap' => 'Enable topic sitemaps',
513 'members_sitemap' => 'Enable member profile sitemaps',
514 'forums_sitemap' => 'Enable forum sitemaps',
515 'allow_ping' => 'Enable search engine pinging',
516 ],
517 'common_issues' => [
518 'Topics not in sitemap' => 'Private or unapproved topics excluded',
519 'Sitemap not updating' => 'Sitemaps cached for 24 hours - wait or clear cache',
520 ],
521 'admin_path' => 'Dashboard > wpForo > Settings > SEO',
522 ],
523
524 // ========== PHRASES (TRANSLATION) ==========
525 'phrases_system' => [
526 'category' => 'phrases',
527 'feature' => 'translation_system',
528 'behavior' => 'Phrases are translatable text strings used throughout wpForo. You can translate to any language or customize default English text.',
529 'features' => [
530 'Add Phrases' => 'Create new translatable strings',
531 'Edit Phrases' => 'Change existing text in any language',
532 'Search' => 'Find phrases by key or value',
533 'Import/Export' => 'XML-based language file management',
534 'Packages' => 'Namespace system for addon phrases',
535 ],
536 'translation_workflow' => [
537 '1. Select language' => 'Choose target language from dropdown',
538 '2. Find phrase' => 'Search by English text or phrase key',
539 '3. Edit translation' => 'Enter translated text',
540 '4. Save' => 'Changes apply immediately',
541 ],
542 'common_issues' => [
543 'Translation not showing' => 'Check correct language is selected, clear cache',
544 'Missing phrases after update' => 'Run phrase crawl to detect new strings',
545 'Addon phrases missing' => 'Check addon package is selected in filter',
546 ],
547 'admin_path' => 'Dashboard > wpForo > Phrases',
548 ],
549
550 // ========== THEMES ==========
551 'themes_system' => [
552 'category' => 'themes',
553 'feature' => 'theme_system',
554 'behavior' => 'wpForo themes control the visual appearance. The 2026 theme is the latest with all 5 layouts. Themes can be customized via child themes or custom CSS.',
555 'available_themes' => [
556 '2026' => 'Latest theme, all 5 layouts including Boxed, modern design',
557 '2022' => 'Previous stable theme, 4 layouts',
558 'Classic' => 'Legacy theme for backwards compatibility',
559 ],
560 'customization' => [
561 'Custom CSS' => 'Settings > Styles > Custom CSS',
562 'Color Styles' => 'Settings > Styles > Forum Color Styles (8 color positions)',
563 'Font Sizes' => 'Settings > Styles > Font sizes for forum/topic/post',
564 'Child Theme' => 'Create wp-content/themes/{child}/wpforo/ folder to override templates',
565 ],
566 'common_issues' => [
567 'Styles not loading' => 'Check for CSS conflicts, clear cache',
568 'Theme customizations lost' => 'Use Custom CSS or child theme instead of editing plugin files',
569 ],
570 'admin_path' => 'Dashboard > wpForo > Themes + Settings > Styles',
571 ],
572
573 // ========== AUTHORIZATION & REGISTRATION ==========
574 'authorization_system' => [
575 'category' => 'authorization',
576 'feature' => 'registration_settings',
577 'behavior' => 'Controls user registration, email confirmation, and role-usergroup mapping. Works with WordPress default registration or can override.',
578 'settings' => [
579 'Use WordPress Registration' => 'Redirect to wp-login.php or use wpForo forms',
580 'Email Confirmation' => 'Require email verification before posting',
581 'Manual Approval' => 'Admin must approve new users',
582 'Default Usergroup' => 'Which group new users join',
583 'Role Sync' => 'Map WordPress roles to wpForo usergroups',
584 ],
585 'common_issues' => [
586 'New users cannot post' => 'Check if email confirmation required but not completed',
587 'Registration not working' => 'Check WordPress registration settings and SMTP',
588 'Wrong usergroup assigned' => 'Check role-usergroup mapping',
589 ],
590 'admin_path' => 'Dashboard > wpForo > Settings > Authorization',
591 ],
592
593 // ========== ANTISPAM ==========
594 'antispam_system' => [
595 'category' => 'antispam',
596 'feature' => 'spam_protection',
597 'behavior' => 'Multiple layers of spam protection: new user restrictions, link detection, flood protection, file scanning, and optional Akismet integration.',
598 'features' => [
599 'New User Limits' => 'Restrict new users from posting links, attachments',
600 'Flood Protection' => 'Prevent rapid posting (per-user and per-IP)',
601 'Auto Unapprove' => 'Send new user posts to moderation',
602 'Link Detection' => 'Flag posts with links from new users',
603 'File Scanning' => 'Check attachments for malware signatures',
604 'Akismet' => 'Optional integration with Akismet spam service',
605 ],
606 'settings' => [
607 'new_user_max_posts' => 'Max posts for new users before limits lift',
608 'unapprove_if_link' => 'Auto-moderate posts with links',
609 'flood_interval' => 'Minimum seconds between posts',
610 'flood_ip_interval' => 'Per-IP posting limit',
611 ],
612 'common_issues' => [
613 'Legitimate users flagged' => 'Lower threshold_posts or disable link detection',
614 'Spam getting through' => 'Enable Akismet, tighten new user limits',
615 ],
616 'admin_path' => 'Dashboard > wpForo > Settings > Antispam + Akismet',
617 ],
618
619 // ========== ACTIVITY SYSTEM ==========
620 'activity_system' => [
621 'category' => 'activity',
622 'feature' => 'activity_logging',
623 'behavior' => 'Tracks forum activities for display in activity feeds and member profiles. Shows recent topics, replies, likes, and other actions.',
624 'logged_activities' => [
625 'New topics' => 'When user creates topic',
626 'New replies' => 'When user posts reply',
627 'Approvals' => 'When content is approved',
628 'Reactions' => 'Likes and other reactions',
629 'Solutions' => 'Topics marked as solved',
630 ],
631 'settings' => [
632 'activity_types' => 'Which activities to track',
633 'display_options' => 'How to show in feeds',
634 'retention' => 'How long to keep activity data',
635 ],
636 'admin_path' => 'Dashboard > wpForo > Settings > Activity',
637 ],
638
639 // ========== RSS FEEDS ==========
640 'rss_system' => [
641 'category' => 'rss',
642 'feature' => 'rss_feeds',
643 'behavior' => 'wpForo generates RSS feeds for forums and topics, allowing users to subscribe via feed readers.',
644 'feed_types' => [
645 'General Forum Feed' => 'All new topics across forums',
646 'Per-Forum Feed' => 'New topics in specific forum',
647 'Per-Topic Feed' => 'New replies to specific topic',
648 ],
649 'settings' => [
650 'rss_general' => 'Enable general forum RSS',
651 'rss_forum' => 'Enable per-forum RSS',
652 'rss_topic' => 'Enable per-topic RSS',
653 ],
654 'admin_path' => 'Dashboard > wpForo > Settings > RSS',
655 ],
656
657 // ========== LEGAL & GDPR ==========
658 'legal_system' => [
659 'category' => 'legal',
660 'feature' => 'gdpr_compliance',
661 'behavior' => 'GDPR and privacy compliance features including consent checkboxes, privacy policy links, data export, and account deletion.',
662 'features' => [
663 'Privacy Policy Page' => 'Link to privacy policy on registration',
664 'Terms Page' => 'Terms of service agreement',
665 'Forum Rules' => 'Display forum-specific rules',
666 'Cookie Notice' => 'GDPR cookie consent',
667 'Data Export' => 'Users can export their data',
668 'Account Deletion' => 'Users can request deletion',
669 ],
670 'admin_path' => 'Dashboard > wpForo > Settings > Legal',
671 ],
672
673 // ========== POSTING SETTINGS ==========
674 'posting_settings' => [
675 'category' => 'posting',
676 'feature' => 'content_rules',
677 'behavior' => 'Controls content length limits, editing timeframes, attachments, and editor options.',
678 'length_limits' => [
679 'topic_title_min/max_length' => 'Topic title character limits',
680 'topic_body_min/max_length' => 'Topic content limits',
681 'post_body_min/max_length' => 'Reply content limits',
682 'comment_body_min/max_length' => 'Q&A comment limits',
683 ],
684 'editing' => [
685 'edit_own_topic_durr' => 'Minutes allowed to edit own topic (0 = unlimited)',
686 'edit_own_post_durr' => 'Minutes allowed to edit own reply',
687 'delete_own_topic_durr' => 'Minutes allowed to delete own topic',
688 'delete_own_post_durr' => 'Minutes allowed to delete own reply',
689 ],
690 'attachments' => [
691 'max_upload_size' => 'Maximum file size in MB',
692 'attachs_to_medialib' => 'Add forum attachments to Media Library',
693 ],
694 'common_issues' => [
695 'Cannot edit old post' => 'Edit time limit expired - check edit_own_post_durr setting',
696 'Content too short error' => 'Increase content or lower min_length setting',
697 'Upload failed' => 'Check max_upload_size and PHP upload_max_filesize',
698 ],
699 'admin_path' => 'Dashboard > wpForo > Settings > Posting',
700 ],
701
702 // ========== NOTIFICATIONS ==========
703 'notifications_system' => [
704 'category' => 'notifications',
705 'feature' => 'live_notifications',
706 'behavior' => 'Real-time notification system with bell icon in forum header. Shows mentions, replies to subscribed topics, likes, etc.',
707 'features' => [
708 'Notification Bell' => 'Shows count of unread notifications',
709 'Live Updates' => 'Real-time updates without page refresh (if enabled)',
710 'Notification Types' => 'Replies, mentions, likes, follows',
711 ],
712 'settings' => [
713 'live_notifications' => 'Enable real-time notification updates',
714 'notification_bell' => 'Display notification bell in header',
715 ],
716 'admin_path' => 'Dashboard > wpForo > Settings > Notifications',
717 ],
718
719 // ========== LOGGING & TRACKING ==========
720 'logging_system' => [
721 'category' => 'logging',
722 'feature' => 'view_tracking',
723 'behavior' => 'Tracks forum/topic views and read status. Enables "jump to unread" and "who viewed" features.',
724 'features' => [
725 'View Logging' => 'Track who views forums and topics',
726 'Read Tracking' => 'Track read/unread status per user',
727 'Jump to Unread' => 'Link to first unread post in topic',
728 'Display Viewers' => 'Show who is currently viewing',
729 ],
730 'common_issues' => [
731 'Unread badges not updating' => 'Check logging is enabled and cookies working',
732 'Performance slow' => 'Disable detailed view logging on high-traffic forums',
733 ],
734 'admin_path' => 'Dashboard > wpForo > Settings > Logging',
735 ],
736 ];
737
738 // ============================================================================
739 // PART 3: DEFINE TROUBLESHOOTING DECISION TREES
740 // ============================================================================
741
742 $troubleshootingTrees = [
743 'user_cannot_edit_profile' => [
744 'title' => 'User Cannot Edit Their Profile',
745 'symptoms' => ['Edit Profile tab missing', 'Save button does nothing', 'Profile fields disabled'],
746 'decision_tree' => [
747 [
748 'check' => 'Is profile editing enabled globally?',
749 'how' => 'Dashboard > wpForo > Settings > Profiles > "Can Edit Profile"',
750 'if_no' => 'Enable the setting',
751 'if_yes' => 'Continue to next check',
752 ],
753 [
754 'check' => 'Does user have enough approved posts?',
755 'how' => 'Check user\'s post count vs Settings > Members > "New User Threshold"',
756 'if_no' => 'User needs more approved posts OR lower threshold',
757 'if_yes' => 'Continue to next check',
758 ],
759 [
760 'check' => 'Does usergroup have profile edit permission?',
761 'how' => 'Dashboard > wpForo > Usergroups > [User\'s Group] > "Can Edit Own Profile"',
762 'if_no' => 'Enable permission for usergroup',
763 'if_yes' => 'Check for plugin conflicts or custom code',
764 ],
765 ],
766 'related_settings' => ['can_edit_profile', 'threshold_posts'],
767 ],
768
769 'topic_not_showing' => [
770 'title' => 'Topic Created But Not Visible',
771 'symptoms' => ['Topic not in listing', 'Author cannot find their topic', 'No error on creation'],
772 'decision_tree' => [
773 [
774 'check' => 'Is topic status approved (status=0)?',
775 'how' => 'Dashboard > wpForo > Moderation - look for topic in queue',
776 'if_no' => 'Topic is in moderation - approve it or check why auto-moderated',
777 'if_yes' => 'Continue to next check',
778 ],
779 [
780 'check' => 'Is topic private?',
781 'how' => 'Edit topic - check "Private" flag',
782 'if_yes' => 'Only author and mods can see it',
783 'if_no' => 'Continue to next check',
784 ],
785 [
786 'check' => 'Does viewer have forum access?',
787 'how' => 'Check viewer\'s usergroup has "vf" and "vt" permission for forum',
788 'if_no' => 'Grant access to usergroup',
789 'if_yes' => 'Clear cache - Dashboard > wpForo > Tools > Clear Cache',
790 ],
791 ],
792 'related_settings' => ['new_user_unapprove', 'topic moderation settings'],
793 ],
794
795 'emails_not_sending' => [
796 'title' => 'Email Notifications Not Being Received',
797 'symptoms' => ['No subscription emails', 'User says they subscribed but no emails', 'Emails delayed'],
798 'decision_tree' => [
799 [
800 'check' => 'Is user actually subscribed?',
801 'how' => 'Dashboard > wpForo > Subscriptions - search for user',
802 'if_no' => 'User needs to subscribe to topic/forum',
803 'if_yes' => 'Continue to next check',
804 ],
805 [
806 'check' => 'Is async email enabled and working?',
807 'how' => 'Dashboard > wpForo > Tools > Email Queue - check Cron Status',
808 'if_stalled' => 'Cron not running - emails fall back to sync but may be slow',
809 'if_healthy' => 'Continue to next check',
810 ],
811 [
812 'check' => 'Are emails being sent at all?',
813 'how' => 'Check Tools > Email Queue > Sent tab for recent emails',
814 'if_no' => 'Check SMTP plugin, wp_mail() function',
815 'if_yes' => 'Emails sent - check spam folder, email deliverability',
816 ],
817 [
818 'check' => 'Is WordPress email working?',
819 'how' => 'Use a plugin like WP Mail SMTP to test email sending',
820 'if_no' => 'Fix WordPress email configuration first',
821 ],
822 ],
823 'related_settings' => ['async_notifications', 'email settings'],
824 ],
825
826 'user_cannot_post' => [
827 'title' => 'User Cannot Create Topic or Reply',
828 'symptoms' => ['No reply button', 'New Topic button missing', 'Permission denied error'],
829 'decision_tree' => [
830 [
831 'check' => 'Is user logged in?',
832 'how' => 'Guest posting might be disabled',
833 'if_no' => 'User needs to login OR enable guest posting',
834 'if_yes' => 'Continue to next check',
835 ],
836 [
837 'check' => 'Does usergroup have posting permission?',
838 'how' => 'Usergroups > [Group] > check "ct" (create topic) and "cr" (create reply)',
839 'if_no' => 'Grant permission to usergroup',
840 'if_yes' => 'Continue to next check',
841 ],
842 [
843 'check' => 'Does usergroup have access to THIS forum?',
844 'how' => 'Forums > Edit Forum > Access tab - check usergroup has ct/cr for this forum',
845 'if_no' => 'Grant forum-specific permission',
846 'if_yes' => 'Continue to next check',
847 ],
848 [
849 'check' => 'Is topic closed?',
850 'how' => 'Check topic status - closed topics block replies',
851 'if_yes' => 'Reopen topic or explain to user',
852 'if_no' => 'Check for flood control or rate limiting',
853 ],
854 ],
855 'related_settings' => ['usergroup permissions', 'forum access settings'],
856 ],
857
858 'ai_search_not_working' => [
859 'title' => 'AI Search Not Finding Results',
860 'symptoms' => ['Search returns nothing', 'Old content not found', 'Only recent content found'],
861 'decision_tree' => [
862 [
863 'check' => 'Is AI connected and subscription active?',
864 'how' => 'Dashboard > wpForo > AI Features > check connection status',
865 'if_no' => 'Connect to AI service or renew subscription',
866 'if_yes' => 'Continue to next check',
867 ],
868 [
869 'check' => 'Is content indexed?',
870 'how' => 'AI Features > AI Content Indexing > check indexed count',
871 'if_no' => 'Start indexing - may take time for large forums',
872 'if_partial' => 'Wait for indexing to complete or index manually',
873 'if_yes' => 'Continue to next check',
874 ],
875 [
876 'check' => 'Does user have access to forums with results?',
877 'how' => 'Search respects forum permissions - private forums excluded',
878 'if_no' => 'Results exist but user cannot see them',
879 'if_yes' => 'Check search quality settings or contact support',
880 ],
881 ],
882 'related_settings' => ['ai settings', 'storage_mode', 'indexing settings'],
883 ],
884
885 'forum_not_visible' => [
886 'title' => 'Forum Not Visible to Users',
887 'symptoms' => ['Forum missing from listing', 'Users report cannot see forum', 'Forum shows for some users not others'],
888 'decision_tree' => [
889 [
890 'check' => 'Is forum status open?',
891 'how' => 'Dashboard > wpForo > Forums > check forum status column',
892 'if_closed' => 'Forum is closed - reopen if needed',
893 'if_open' => 'Continue to next check',
894 ],
895 [
896 'check' => 'Does usergroup have "vf" (view forum) permission?',
897 'how' => 'Forums > Edit Forum > Access tab > check usergroup row for "vf"',
898 'if_no' => 'Enable "vf" permission for affected usergroup',
899 'if_yes' => 'Continue to next check',
900 ],
901 [
902 'check' => 'Is forum set to private/restricted access?',
903 'how' => 'Forums > Edit Forum > Access > check if only specific groups have access',
904 'if_yes' => 'Add usergroups that should have access',
905 'if_no' => 'Clear cache - may be caching issue',
906 ],
907 ],
908 'related_settings' => ['forum permissions', 'usergroup access'],
909 ],
910
911 'wrong_usergroup_assigned' => [
912 'title' => 'User Has Wrong Usergroup',
913 'symptoms' => ['Wrong permissions', 'User cannot do things they should', 'Badge shows wrong group'],
914 'decision_tree' => [
915 [
916 'check' => 'What WordPress role does user have?',
917 'how' => 'Users > Edit User > check Role dropdown',
918 'if_wrong' => 'Fix WordPress role first - wpForo syncs from WP roles',
919 'if_correct' => 'Continue to next check',
920 ],
921 [
922 'check' => 'Is role-to-usergroup mapping correct?',
923 'how' => 'Dashboard > wpForo > Usergroups > check "WordPress Role" column',
924 'if_no' => 'Edit usergroup to map to correct WordPress role',
925 'if_yes' => 'Continue to next check',
926 ],
927 [
928 'check' => 'Does user have manually assigned usergroup?',
929 'how' => 'Dashboard > wpForo > Members > Edit Member > check Usergroup field',
930 'if_manual' => 'Manual assignment overrides role sync - change if needed',
931 'if_auto' => 'Check for secondary usergroups that may be affecting permissions',
932 ],
933 ],
934 'related_settings' => ['role sync settings', 'usergroup mapping'],
935 ],
936
937 'signature_not_showing' => [
938 'title' => 'User Signature Not Displaying',
939 'symptoms' => ['Signature field empty', 'Signature saved but not shown', 'Some users have signatures others do not'],
940 'decision_tree' => [
941 [
942 'check' => 'Is signature feature enabled globally?',
943 'how' => 'Dashboard > wpForo > Settings > Profiles > "Member Signature"',
944 'if_disabled' => 'Enable signatures globally',
945 'if_enabled' => 'Continue to next check',
946 ],
947 [
948 'check' => 'Does user have enough approved posts?',
949 'how' => 'Check user post count vs Settings > Members > "New User Threshold"',
950 'if_below' => 'User needs more approved posts to display signature',
951 'if_above' => 'Continue to next check',
952 ],
953 [
954 'check' => 'Does usergroup have signature permission?',
955 'how' => 'Dashboard > wpForo > Usergroups > [Group] > "Can Have Signature" (ups)',
956 'if_no' => 'Enable signature permission for usergroup',
957 'if_yes' => 'Check if signature contains HTML/links that are being stripped',
958 ],
959 ],
960 'related_settings' => ['signature settings', 'threshold_posts', 'usergroup permissions'],
961 ],
962
963 'avatar_not_showing' => [
964 'title' => 'User Avatar Not Displaying',
965 'symptoms' => ['Default avatar shows', 'Uploaded avatar not appearing', 'Gravatar not loading'],
966 'decision_tree' => [
967 [
968 'check' => 'Is custom avatar enabled?',
969 'how' => 'Dashboard > wpForo > Settings > Profiles > "Custom Avatar"',
970 'if_disabled' => 'Enable custom avatars',
971 'if_enabled' => 'Continue to next check',
972 ],
973 [
974 'check' => 'Does user have enough posts to upload avatar?',
975 'how' => 'Check threshold_posts setting - new users may be restricted',
976 'if_no' => 'User needs more posts OR lower threshold',
977 'if_yes' => 'Continue to next check',
978 ],
979 [
980 'check' => 'Does usergroup have avatar upload permission?',
981 'how' => 'Dashboard > wpForo > Usergroups > [Group] > "Can Upload Avatar" (upa)',
982 'if_no' => 'Enable avatar permission',
983 'if_yes' => 'Check file upload size limits and image format',
984 ],
985 ],
986 'related_settings' => ['avatar settings', 'upload limits'],
987 ],
988
989 'cache_issues' => [
990 'title' => 'Content Not Updating / Cache Issues',
991 'symptoms' => ['Old content showing', 'Changes not appearing', 'Different users see different content'],
992 'decision_tree' => [
993 [
994 'check' => 'Clear wpForo cache',
995 'how' => 'Dashboard > wpForo > Dashboard > Clear Cache button',
996 'after' => 'Check if issue resolved',
997 'if_no' => 'Continue to next check',
998 ],
999 [
1000 'check' => 'Is external cache plugin active?',
1001 'how' => 'Check for WP Super Cache, W3 Total Cache, LiteSpeed, WP Rocket, etc.',
1002 'if_yes' => 'Exclude forum pages from external cache OR clear external cache',
1003 'if_no' => 'Continue to next check',
1004 ],
1005 [
1006 'check' => 'Is there server-level caching?',
1007 'how' => 'Check with hosting provider for Varnish, Redis, or CDN caching',
1008 'if_yes' => 'Purge server cache or add forum exclusion rules',
1009 'if_no' => 'Check browser cache - try incognito/private mode',
1010 ],
1011 ],
1012 'related_settings' => ['cache settings', 'external cache plugin settings'],
1013 ],
1014
1015 'threaded_replies_flat' => [
1016 'title' => 'Threaded Replies Not Nesting',
1017 'symptoms' => ['All replies at same level', 'No indentation', 'Flat reply list'],
1018 'decision_tree' => [
1019 [
1020 'check' => 'Is forum using Threaded layout (Layout 4)?',
1021 'how' => 'Dashboard > Forums > Edit Forum > check Layout dropdown',
1022 'if_no' => 'Switch to Threaded layout for nested replies',
1023 'if_yes' => 'Continue to next check',
1024 ],
1025 [
1026 'check' => 'Is nesting level set correctly?',
1027 'how' => 'Settings > Forums > "Threaded Layout - Replies Nesting Levels Deep"',
1028 'if_zero' => 'Increase nesting level (default 5)',
1029 'if_correct' => 'Continue to next check',
1030 ],
1031 [
1032 'check' => 'Are users replying to specific posts?',
1033 'how' => 'Users must click Reply on specific post, not general reply button',
1034 'if_no' => 'Instruct users to use per-post Reply buttons',
1035 'if_yes' => 'Check theme CSS for display issues',
1036 ],
1037 ],
1038 'related_settings' => ['layout_threaded_nesting_level', 'forum layout'],
1039 ],
1040
1041 'qa_voting_not_working' => [
1042 'title' => 'Q&A Voting Not Working',
1043 'symptoms' => ['Vote buttons missing', 'Votes not counting', 'Cannot mark best answer'],
1044 'decision_tree' => [
1045 [
1046 'check' => 'Is forum using Q&A layout (Layout 3)?',
1047 'how' => 'Dashboard > Forums > Edit Forum > check Layout is "Q&A"',
1048 'if_no' => 'Switch to Q&A layout for voting functionality',
1049 'if_yes' => 'Continue to next check',
1050 ],
1051 [
1052 'check' => 'Does usergroup have vote permission?',
1053 'how' => 'Forums > Edit Forum > Access > check "v" (vote) for usergroup',
1054 'if_no' => 'Enable vote permission',
1055 'if_yes' => 'Continue to next check',
1056 ],
1057 [
1058 'check' => 'Can user mark best answer?',
1059 'how' => 'Only topic author or users with "sv" permission can mark solved',
1060 'if_not_author' => 'User needs "sv" (solved) permission in forum access',
1061 'if_author' => 'Check for JavaScript errors in browser console',
1062 ],
1063 ],
1064 'related_settings' => ['forum layout', 'vote permission', 'solved permission'],
1065 ],
1066
1067 'multiboard_content_missing' => [
1068 'title' => 'Content Missing in Multi-Board Setup',
1069 'symptoms' => ['Topics not found', 'Forums empty on one board', 'Content appears on wrong board'],
1070 'decision_tree' => [
1071 [
1072 'check' => 'Are you viewing the correct board?',
1073 'how' => 'Check URL slug - each board has different slug (e.g., /community/ vs /support/)',
1074 'if_wrong' => 'Navigate to correct board',
1075 'if_correct' => 'Continue to next check',
1076 ],
1077 [
1078 'check' => 'Was content created on this board?',
1079 'how' => 'Content is board-specific - forums/topics/posts do not share between boards',
1080 'if_wrong_board' => 'Content exists on different board - recreate or use correct board',
1081 'if_correct' => 'Continue to next check',
1082 ],
1083 [
1084 'check' => 'Are forums created on this board?',
1085 'how' => 'Dashboard > wpForo > Boards > select board > Forums',
1086 'if_no' => 'Create forums for this board',
1087 'if_yes' => 'Check board-specific settings and permissions',
1088 ],
1089 ],
1090 'related_settings' => ['board settings', 'board-specific options'],
1091 ],
1092
1093 'registration_issues' => [
1094 'title' => 'User Registration Not Working',
1095 'symptoms' => ['Cannot register', 'Email not received', 'Account not created'],
1096 'decision_tree' => [
1097 [
1098 'check' => 'Is user registration enabled in WordPress?',
1099 'how' => 'Settings > General > "Anyone can register"',
1100 'if_disabled' => 'Enable WordPress registration',
1101 'if_enabled' => 'Continue to next check',
1102 ],
1103 [
1104 'check' => 'Is wpForo using WordPress or custom registration?',
1105 'how' => 'Dashboard > wpForo > Settings > Authorization > registration settings',
1106 'if_wp' => 'Check WordPress registration flow',
1107 'if_custom' => 'Check wpForo registration form and settings',
1108 ],
1109 [
1110 'check' => 'Is email confirmation required?',
1111 'how' => 'Settings > Authorization > "Email Confirmation"',
1112 'if_yes' => 'User must click confirmation link in email - check spam folder',
1113 'if_no' => 'Check for reCAPTCHA issues or form validation errors',
1114 ],
1115 [
1116 'check' => 'Is WordPress email working?',
1117 'how' => 'Install WP Mail SMTP or similar to test email',
1118 'if_no' => 'Fix WordPress email first',
1119 'if_yes' => 'Check server error logs for registration errors',
1120 ],
1121 ],
1122 'related_settings' => ['authorization settings', 'email settings', 'reCAPTCHA'],
1123 ],
1124
1125 'spam_issues' => [
1126 'title' => 'Too Much Spam Getting Through',
1127 'symptoms' => ['Spam topics appearing', 'Spam replies', 'Bot registrations'],
1128 'decision_tree' => [
1129 [
1130 'check' => 'Is reCAPTCHA enabled?',
1131 'how' => 'Dashboard > wpForo > Settings > reCAPTCHA > enable and add keys',
1132 'if_no' => 'Enable reCAPTCHA v3 for invisible protection',
1133 'if_yes' => 'Continue to next check',
1134 ],
1135 [
1136 'check' => 'Is new user moderation enabled?',
1137 'how' => 'Settings > Antispam > "Auto Unapprove New User Posts"',
1138 'if_no' => 'Enable to catch spam before it publishes',
1139 'if_yes' => 'Continue to next check',
1140 ],
1141 [
1142 'check' => 'Is Akismet integrated?',
1143 'how' => 'Settings > Akismet > enable integration',
1144 'if_no' => 'Enable Akismet for spam detection',
1145 'if_yes' => 'Increase threshold_posts to restrict new users longer',
1146 ],
1147 ],
1148 'related_settings' => ['reCAPTCHA', 'antispam settings', 'Akismet', 'threshold_posts'],
1149 ],
1150 ];
1151
1152 // ============================================================================
1153 // PART 4: GENERATE OUTPUT FILES
1154 // ============================================================================
1155
1156 echo "Generating knowledge files...\n";
1157
1158 // 4.1 Settings Documentation
1159 $settingsDoc = "# wpForo Settings Reference\n\n";
1160 $settingsDoc .= "Complete reference of all wpForo settings with behavioral effects.\n\n";
1161 $settingsDoc .= "## Quick Reference\n\n";
1162 $settingsDoc .= "| Setting | Type | Purpose |\n";
1163 $settingsDoc .= "|---------|------|----------|\n";
1164
1165 foreach ($settings as $name => $setting) {
1166 $label = substr($setting['label'], 0, 50);
1167 $settingsDoc .= "| `{$name}` | {$setting['type']} | {$label} |\n";
1168 }
1169
1170 $settingsDoc .= "\n---\n\n## Behavioral Knowledge\n\n";
1171 $settingsDoc .= "This section explains HOW settings affect user experience.\n\n";
1172
1173 foreach ($behavioralKnowledge as $key => $knowledge) {
1174 $title = $knowledge['setting'] ?? $knowledge['feature'];
1175 $settingsDoc .= "### {$title}\n\n";
1176 $settingsDoc .= "**Category**: {$knowledge['category']}\n\n";
1177 $settingsDoc .= "**Behavior**: {$knowledge['behavior']}\n\n";
1178
1179 if (isset($knowledge['affects'])) {
1180 $settingsDoc .= "**Affects**:\n";
1181 foreach ($knowledge['affects'] as $effect) {
1182 $settingsDoc .= "- {$effect}\n";
1183 }
1184 $settingsDoc .= "\n";
1185 }
1186
1187 if (isset($knowledge['common_issues'])) {
1188 $settingsDoc .= "**Common Issues**:\n";
1189 foreach ($knowledge['common_issues'] as $issue => $solution) {
1190 $settingsDoc .= "- **{$issue}**: {$solution}\n";
1191 }
1192 $settingsDoc .= "\n";
1193 }
1194
1195 if (isset($knowledge['admin_path'])) {
1196 $settingsDoc .= "**Admin Path**: {$knowledge['admin_path']}\n\n";
1197 }
1198
1199 $settingsDoc .= "---\n\n";
1200 }
1201
1202 file_put_contents("$OUTPUT_DIR/settings/settings-reference.md", $settingsDoc);
1203 echo " Generated: settings/settings-reference.md\n";
1204
1205 // 4.2 Troubleshooting Guides
1206 foreach ($troubleshootingTrees as $key => $tree) {
1207 $troubleDoc = "# {$tree['title']}\n\n";
1208 $troubleDoc .= "## Symptoms\n\n";
1209 foreach ($tree['symptoms'] as $symptom) {
1210 $troubleDoc .= "- {$symptom}\n";
1211 }
1212 $troubleDoc .= "\n## Diagnostic Steps\n\n";
1213
1214 $step = 1;
1215 foreach ($tree['decision_tree'] as $check) {
1216 $troubleDoc .= "### Step {$step}: {$check['check']}\n\n";
1217 $troubleDoc .= "**How to check**: {$check['how']}\n\n";
1218
1219 foreach ($check as $condition => $action) {
1220 if (strpos($condition, 'if_') === 0) {
1221 $condLabel = ucfirst(str_replace(['if_', '_'], ['', ' '], $condition));
1222 $troubleDoc .= "- **{$condLabel}**: {$action}\n";
1223 }
1224 }
1225 $troubleDoc .= "\n";
1226 $step++;
1227 }
1228
1229 if (isset($tree['related_settings'])) {
1230 $troubleDoc .= "## Related Settings\n\n";
1231 foreach ($tree['related_settings'] as $setting) {
1232 $troubleDoc .= "- `{$setting}`\n";
1233 }
1234 }
1235
1236 file_put_contents("$OUTPUT_DIR/troubleshooting/{$key}.md", $troubleDoc);
1237 }
1238 echo " Generated: " . count($troubleshootingTrees) . " troubleshooting guides\n";
1239
1240 // 4.3 Feature Documentation
1241 $featureDoc = "# wpForo Features Overview\n\n";
1242
1243 $features = [
1244 'user_system' => [
1245 'title' => 'User & Member System',
1246 'description' => 'wpForo extends WordPress users with forum-specific profiles, usergroups, and permissions.',
1247 'key_concepts' => [
1248 'wpForo Profile syncs with WordPress user',
1249 'Usergroups define capabilities (what users CAN do)',
1250 'Forum Access defines permissions per-forum (WHERE users can do things)',
1251 'New User Threshold determines when user becomes "trusted"',
1252 ],
1253 'admin_locations' => [
1254 'Members' => 'Dashboard > wpForo > Members',
1255 'Usergroups' => 'Dashboard > wpForo > Usergroups',
1256 'Settings' => 'Dashboard > wpForo > Settings > Members/Profiles',
1257 ],
1258 ],
1259 'topic_system' => [
1260 'title' => 'Topics & Posts',
1261 'description' => 'Forum content organization with topics (threads) containing posts (replies).',
1262 'key_concepts' => [
1263 'Topics have status: approved(0), unapproved(1)',
1264 'Topics can be: open/closed, private/public, solved/unsolved',
1265 'Posts belong to topics and can be nested (threaded layout)',
1266 'First post of topic is special (is_first_post=1)',
1267 ],
1268 'admin_locations' => [
1269 'Moderation' => 'Dashboard > wpForo > Moderation',
1270 'Settings' => 'Dashboard > wpForo > Settings > Topics/Posting',
1271 ],
1272 ],
1273 'permission_system' => [
1274 'title' => 'Permissions & Access Control',
1275 'description' => 'Two-layer permission system: Usergroup capabilities + Forum-specific access.',
1276 'key_concepts' => [
1277 'Usergroup = WHAT user can do (capabilities)',
1278 'Forum Access = WHERE user can do it (per-forum permissions)',
1279 'Permission codes: vf, vt, ct, cr, et, er, dt, dr, l, v, s, au',
1280 'Private forums require explicit access grant',
1281 ],
1282 'permission_codes' => [
1283 'vf' => 'View Forum',
1284 'vt' => 'View Topics',
1285 'vp' => 'View Private Topics',
1286 'ct' => 'Create Topic',
1287 'cr' => 'Create Reply',
1288 'et' => 'Edit Own Topic',
1289 'er' => 'Edit Own Reply',
1290 'dt' => 'Delete Own Topic',
1291 'dr' => 'Delete Own Reply',
1292 'l' => 'Like/React',
1293 'v' => 'Vote (Q&A)',
1294 's' => 'Subscribe',
1295 'au' => 'Auto-Unapprove bypass',
1296 ],
1297 ],
1298 'subscription_system' => [
1299 'title' => 'Subscriptions & Notifications',
1300 'description' => 'Email notification system for forum activity.',
1301 'key_concepts' => [
1302 'Users subscribe to forums or topics',
1303 'Emails sent on new topic/reply in subscribed item',
1304 'Async queue prevents slow page loads (optional)',
1305 'Respects WordPress SMTP plugins',
1306 ],
1307 ],
1308 'moderation_system' => [
1309 'title' => 'Content Moderation',
1310 'description' => 'Review and approve content before publication.',
1311 'key_concepts' => [
1312 'New user posts can auto-queue for moderation',
1313 'Posts with links from new users can be flagged',
1314 'AI Moderation (optional) detects problematic content',
1315 'Moderators see unapproved content with approve/reject',
1316 ],
1317 ],
1318 'layout_system' => [
1319 'title' => 'Forum Layouts',
1320 'description' => 'wpForo offers 5 different layouts for different forum styles, set per-forum.',
1321 'key_concepts' => [
1322 'Extended (1) - Info-rich with topic previews',
1323 'Simplified (2) - Clean minimal design',
1324 'Q&A (3) - Question/Answer with voting and best answer',
1325 'Threaded (4) - Nested reply tree like Reddit',
1326 'Boxed (5) - Modern card-based design (2026 theme)',
1327 ],
1328 'admin_locations' => [
1329 'Set Layout' => 'Dashboard > Forums > Edit Forum > Layout dropdown',
1330 'Layout Settings' => 'Dashboard > wpForo > Settings > Forums',
1331 ],
1332 ],
1333 'board_system' => [
1334 'title' => 'Multi-Board System',
1335 'description' => 'Run multiple separate forum instances within one WordPress installation.',
1336 'key_concepts' => [
1337 'Each board has its own forums, topics, posts',
1338 'Boards can have different URLs, languages, settings',
1339 'User profiles are SHARED across boards',
1340 'Settings can be global or board-specific',
1341 'Default board (ID 0) uses standard table names',
1342 ],
1343 'admin_locations' => [
1344 'Manage Boards' => 'Dashboard > wpForo > Boards',
1345 'Board Settings' => 'Dashboard > wpForo > Settings (select board)',
1346 ],
1347 ],
1348 'cache_system' => [
1349 'title' => 'Caching System',
1350 'description' => 'File-based caching for improved performance.',
1351 'key_concepts' => [
1352 'Caches forums, topics, posts, avatars, URLs',
1353 'Auto-invalidates on content changes',
1354 'RAM cache for single request optimization',
1355 'Compatible with external cache plugins (with exclusions)',
1356 ],
1357 'admin_locations' => [
1358 'Clear Cache' => 'Dashboard > wpForo > Dashboard',
1359 'Cache Settings' => 'Dashboard > wpForo > Settings > Board',
1360 ],
1361 ],
1362 'seo_system' => [
1363 'title' => 'SEO & Sitemaps',
1364 'description' => 'Search engine optimization with XML sitemaps.',
1365 'key_concepts' => [
1366 'Forum sitemap, topic sitemap, profile sitemap',
1367 'Automatic ping to Google/Bing on new content',
1368 'Only includes publicly accessible content',
1369 'Respects forum permissions',
1370 ],
1371 'admin_locations' => [
1372 'SEO Settings' => 'Dashboard > wpForo > Settings > SEO',
1373 ],
1374 ],
1375 'phrases_system' => [
1376 'title' => 'Phrases & Translation',
1377 'description' => 'Multi-language support through translatable phrases.',
1378 'key_concepts' => [
1379 'All text is translatable via Phrases admin',
1380 'Import/export language files (XML)',
1381 'Addon phrases organized by package',
1382 'Supports all WordPress locales',
1383 ],
1384 'admin_locations' => [
1385 'Manage Phrases' => 'Dashboard > wpForo > Phrases',
1386 ],
1387 ],
1388 'tools_system' => [
1389 'title' => 'Admin Tools',
1390 'description' => 'Debugging, database management, and email queue tools.',
1391 'key_concepts' => [
1392 'Debug - Server info, user data viewer, error logs',
1393 'Database Tables - Schema viewer, problem detection, repair',
1394 'Email Queue - Async email status, retry failed, cron health',
1395 'Admin Note - Forum-wide announcements',
1396 ],
1397 'admin_locations' => [
1398 'Tools' => 'Dashboard > wpForo > Tools',
1399 ],
1400 ],
1401 'theme_system' => [
1402 'title' => 'Themes & Styling',
1403 'description' => 'Visual customization through themes and CSS.',
1404 'key_concepts' => [
1405 '2026 theme is latest with all 5 layouts',
1406 'Custom CSS field for modifications',
1407 '8 color positions for forum styling',
1408 'Child theme support for template overrides',
1409 ],
1410 'admin_locations' => [
1411 'Select Theme' => 'Dashboard > wpForo > Themes',
1412 'Custom Styles' => 'Dashboard > wpForo > Settings > Styles',
1413 ],
1414 ],
1415 'ai_system' => [
1416 'title' => 'AI Features',
1417 'description' => 'AI-powered features including search, suggestions, moderation, and chatbot.',
1418 'key_concepts' => [
1419 'Semantic Search - Find content by meaning, not keywords',
1420 'Topic Suggestions - Suggest similar topics before posting',
1421 'AI Moderation - Auto-detect spam, toxicity, violations',
1422 'AI Chatbot - Answer questions from forum content',
1423 'Translation & Summarization - AI-powered content tools',
1424 'Requires gVectors AI subscription and content indexing',
1425 ],
1426 'admin_locations' => [
1427 'AI Dashboard' => 'Dashboard > wpForo > AI Features',
1428 'AI Settings' => 'Dashboard > wpForo > Settings > AI',
1429 ],
1430 ],
1431 'antispam_system' => [
1432 'title' => 'Spam Protection',
1433 'description' => 'Multi-layer spam prevention for forums.',
1434 'key_concepts' => [
1435 'New user restrictions (links, attachments, posts)',
1436 'Flood protection (per-user and per-IP)',
1437 'Auto-moderation for new user posts',
1438 'Akismet integration (optional)',
1439 'reCAPTCHA support (v2/v3)',
1440 ],
1441 'admin_locations' => [
1442 'Antispam' => 'Dashboard > wpForo > Settings > Antispam',
1443 'Akismet' => 'Dashboard > wpForo > Settings > Akismet',
1444 'reCAPTCHA' => 'Dashboard > wpForo > Settings > reCAPTCHA',
1445 ],
1446 ],
1447 'legal_system' => [
1448 'title' => 'Legal & GDPR',
1449 'description' => 'Privacy compliance features for forums.',
1450 'key_concepts' => [
1451 'Privacy policy and terms page links',
1452 'Forum rules display',
1453 'Cookie consent notice',
1454 'User data export and deletion',
1455 ],
1456 'admin_locations' => [
1457 'Legal Settings' => 'Dashboard > wpForo > Settings > Legal',
1458 ],
1459 ],
1460 ];
1461
1462 foreach ($features as $key => $feature) {
1463 $featureDoc .= "## {$feature['title']}\n\n";
1464 $featureDoc .= "{$feature['description']}\n\n";
1465
1466 $featureDoc .= "### Key Concepts\n\n";
1467 foreach ($feature['key_concepts'] as $concept) {
1468 $featureDoc .= "- {$concept}\n";
1469 }
1470 $featureDoc .= "\n";
1471
1472 if (isset($feature['permission_codes'])) {
1473 $featureDoc .= "### Permission Codes\n\n";
1474 $featureDoc .= "| Code | Meaning |\n|------|--------|\n";
1475 foreach ($feature['permission_codes'] as $code => $meaning) {
1476 $featureDoc .= "| `{$code}` | {$meaning} |\n";
1477 }
1478 $featureDoc .= "\n";
1479 }
1480
1481 if (isset($feature['admin_locations'])) {
1482 $featureDoc .= "### Admin Locations\n\n";
1483 foreach ($feature['admin_locations'] as $name => $path) {
1484 $featureDoc .= "- **{$name}**: {$path}\n";
1485 }
1486 $featureDoc .= "\n";
1487 }
1488
1489 $featureDoc .= "---\n\n";
1490 }
1491
1492 file_put_contents("$OUTPUT_DIR/features/features-overview.md", $featureDoc);
1493 echo " Generated: features/features-overview.md\n";
1494
1495 // 4.4 Generate chunks for RAG indexing
1496 $chunks = [];
1497 $chunkId = 1;
1498
1499 // Add behavioral knowledge as chunks
1500 foreach ($behavioralKnowledge as $key => $knowledge) {
1501 $content = "Setting/Feature: " . ($knowledge['setting'] ?? $knowledge['feature']) . "\n\n";
1502 $content .= "Behavior: {$knowledge['behavior']}\n\n";
1503
1504 if (isset($knowledge['common_issues'])) {
1505 $content .= "Common Issues:\n";
1506 foreach ($knowledge['common_issues'] as $issue => $solution) {
1507 $content .= "- {$issue}: {$solution}\n";
1508 }
1509 }
1510
1511 $chunks[] = [
1512 'id' => "expert-behavior-{$chunkId}",
1513 'title' => $knowledge['setting'] ?? $knowledge['feature'],
1514 'content' => $content,
1515 'category' => $knowledge['category'],
1516 'type' => 'behavioral_knowledge',
1517 'content_source' => 'wpforo_expert',
1518 'priority' => 1.0,
1519 ];
1520 $chunkId++;
1521 }
1522
1523 // Add troubleshooting as chunks
1524 foreach ($troubleshootingTrees as $key => $tree) {
1525 $content = "Problem: {$tree['title']}\n\n";
1526 $content .= "Symptoms: " . implode(", ", $tree['symptoms']) . "\n\n";
1527 $content .= "Diagnostic Steps:\n";
1528
1529 foreach ($tree['decision_tree'] as $i => $check) {
1530 $content .= ($i+1) . ". {$check['check']} ({$check['how']})\n";
1531 }
1532
1533 $chunks[] = [
1534 'id' => "expert-troubleshoot-{$chunkId}",
1535 'title' => $tree['title'],
1536 'content' => $content,
1537 'category' => 'troubleshooting',
1538 'type' => 'troubleshooting_guide',
1539 'content_source' => 'wpforo_expert',
1540 'priority' => 1.0,
1541 ];
1542 $chunkId++;
1543 }
1544
1545 // Add feature docs as chunks
1546 foreach ($features as $key => $feature) {
1547 $content = "{$feature['title']}\n\n";
1548 $content .= "{$feature['description']}\n\n";
1549 $content .= "Key Concepts:\n";
1550 foreach ($feature['key_concepts'] as $concept) {
1551 $content .= "- {$concept}\n";
1552 }
1553
1554 $chunks[] = [
1555 'id' => "expert-feature-{$chunkId}",
1556 'title' => $feature['title'],
1557 'content' => $content,
1558 'category' => 'features',
1559 'type' => 'feature_documentation',
1560 'content_source' => 'wpforo_expert',
1561 'priority' => 0.9,
1562 ];
1563 $chunkId++;
1564 }
1565
1566 file_put_contents("$OUTPUT_DIR/for-indexing/chunks.json", json_encode($chunks, JSON_PRETTY_PRINT));
1567 echo " Generated: for-indexing/chunks.json (" . count($chunks) . " chunks)\n";
1568
1569 // 4.5 Generate manifest for incremental updates
1570 $manifest = [
1571 'generated_at' => date('Y-m-d H:i:s'),
1572 'version' => '1.0.0',
1573 'stats' => [
1574 'settings' => count($settings),
1575 'behavioral_knowledge' => count($behavioralKnowledge),
1576 'troubleshooting_guides' => count($troubleshootingTrees),
1577 'features' => count($features),
1578 'total_chunks' => count($chunks),
1579 ],
1580 'files' => [
1581 'settings/settings-reference.md',
1582 'features/features-overview.md',
1583 'for-indexing/chunks.json',
1584 ],
1585 'troubleshooting_files' => array_map(fn($k) => "troubleshooting/{$k}.md", array_keys($troubleshootingTrees)),
1586 ];
1587
1588 file_put_contents("$OUTPUT_DIR/manifest.json", json_encode($manifest, JSON_PRETTY_PRINT));
1589 echo " Generated: manifest.json\n";
1590
1591 echo "\n=== Summary ===\n";
1592 echo "Settings documented: " . count($settings) . "\n";
1593 echo "Behavioral knowledge items: " . count($behavioralKnowledge) . "\n";
1594 echo "Troubleshooting guides: " . count($troubleshootingTrees) . "\n";
1595 echo "Feature docs: " . count($features) . "\n";
1596 echo "RAG chunks: " . count($chunks) . "\n";
1597 echo "\nOutput: $OUTPUT_DIR\n";
1598 echo "\nTo add this to AI:\n";
1599 echo " POST /v1/ingest/knowledge-base\n";
1600 echo " Body: contents of for-indexing/chunks.json\n";
1601