addons/example-hello-world/main.php
1 <?php
2 /**
3 * Hello World — Example addon
4 * Appends a small note below every post footer. Demonstrates the hook system.
5 */
6 if (!defined('NEXUS')) exit('Forbidden');
7
8 addon_on('render_post_footer', function (array $post): string {
9 // Return empty string to add nothing, or HTML to append below the post
10 return ''; // Disabled by default — remove the return to activate
11 return '<div style="font-size:11px;color:#94a3b8;margin-top:8px;padding-top:6px;'
12 . 'border-top:1px solid var(--border)">Hello World addon is active ✓</div>';
13 }, 999);
14
15 addon_on('after_topic_created', function (array $data): void {
16 // $data: topic_id, title, slug, category_id, user_id
17 // Example: error_log("New topic created: " . $data['title']);
18 });