Ledger – Open Support Framework

Plugin System Guide

2026-02-06 · Updated 2026-02-07

A basic page builder system. Currently, in Stage 1 - foundational implementation.

Current Status: Functional but rudimentary. Allows creation of custom pages by dropping PHP files into /plugins/ directory.


How It Works (Stage 1)

The Two Critical Pieces

  1. Filename: Becomes the page URL slug
  2. Hook name: Must match filename pattern

Example:

  • File: /plugins/hello_world.php
  • Hook: plugin_content_hello_world
  • URL: plugin.php?t=hello_world

Basic Structure

<?php
/**
 * Plugin Name: My Page
 * Version: 1.0.0
 * Description: Description here
 * Author: Your name
 */
 add_action('plugin_content_my_page', function() {
    ?>     <div class="card">
    		  <div class="card-body">
    		  	<h1>Your content here</h1>         
    		  </div>     
    	   </div>     
<?php
});

What's Available

  • Database connection: global $conn;
  • Current user: global $currentUser;
  • Bootstrap 5 styling (site-wide)
  • Site header/footer automatically included

Examples

View Members

<?php
add_action('plugin_content_latest_news', function() {
    global $conn;
    
    $users = $conn->query("SELECT name, forum_about FROM users LIMIT 5");
    ?>
    
    <div class="card shadow-sm mb-4">
        <div class="card-body">
            <h3>Recent Members</h3>
            <?php if ($users->num_rows > 0): ?>
                <ul class="list-group">
                    <?php while ($row = $users->fetch_assoc()): ?>
                        <li class="list-group-item">
                            <strong><?= htmlspecialchars($row['name']) ?></strong><br>
                            <small class="text-muted"><?= htmlspecialchars($row['forum_about']) ?></small>
                        </li>
                    <?php endwhile; ?>
                </ul>
            <?php endif; ?>
        </div>
    </div>
    
<?php
});
?>

Show Forum Categories

<?php
add_action('plugin_content_latest_news', function() {
    global $conn;
    
    $forum = $conn->query("SELECT name, description, slug FROM forum_categories ORDER BY created_at DESC LIMIT 6");
    ?>
<div class="row">
    <?php if ($forum->num_rows > 0): ?>
        <?php while ($row = $forum->fetch_assoc()): ?>
            <div class="col-md-4 mb-4">
                <div class="card shadow-sm h-100">
                    <div class="card-body">
                        <h5 class="card-title"><?= htmlspecialchars($row['name']) ?></h5>
                        <p class="card-text"><?= substr($row['description'], 0, 100) ?> ...</p>
                        <a href="<?= htmlspecialchars($row['slug']) ?>" class="btn btn-primary btn-sm">Read More</a>
                    </div>
                </div>
            </div>
        <?php endwhile; ?>
    <?php endif; ?>
</div>

Limitations

  • No activation/deactivation toggle
  • No settings page per plugin
  • No hooks in existing pages yet
  • No plugin dependencies
  • No update system

Future Development

Stage 2 and beyond may include:

  • Hooks in existing pages (do_action() / apply_filters())
  • Plugin settings/configuration
  • Multi-file plugin support
  • Asset management (CSS/JS)
  • Inter-plugin communication

Support

Issues or questions visit the Development Discussion forum.


Is this document high quality? Or does it need improvement? High ranking articles display in the footer, admin notified if improvements required.

Log in to rate this document
Rating: 0.0 / 5 (0)