How ericrosenberg1/nonprofit-manager works
Project Type and Purpose
• This is a WordPress plugin (“Nonprofit Manager”) whose goal is to help nonprofits manage members, donations, emails/newsletters, events, and payments.
• It provides Gutenberg blocks, shortcodes, admin pages, background tasks (via WP-Cron), and integrations with external services (SMTP email providers, PayPal).
File Structure
• Top‐level:
• nonprofit-manager.php – the plugin bootstrap (registers hooks, loads modules).
• assets/js – front-end scripts (donation form, block scripts).
• blocks/ – Gutenberg block registrations (email composer).
• includes/ – the core PHP modules:
– activation-hooks.php
– email-newsletter/ (editor UI, manager/tracker classes, reports, templates)
– email/smtp.php
– npmp-*.php (admin settings, calendar, email-delivery, email-newsletter, email-settings, members, membership forms, payments settings, scripts)
– payments/npmp-paypal.php
• How each feature (Members, Payments, Email, Calendar) lives in its own module under includes.
README for Additional Insights
• Features: transactional email setup, payment gateway configuration, Gutenberg Email Composer, shortcodes for forms.
• External services: SMTP mailer (configurable), PayPal SDK/data flow.
• Background tasks: email queueing and delivery via WP-Cron.
• Data storage: plugin settings and sensitive keys in the wp_options table; likely custom database tables or post types for members, events.
Main Components and Their Interactions
a. Frontend Layer:
• WordPress Core (theme + plugins)
• Shortcode handlers (in includes/npmp-*.php) render HTML forms and Gutenberg blocks (blocks/email-composer.js).
• assets/js → donation-form.js loads PayPal SDK; np-blocks.js registers/enhances blocks.
b. Plugin Backend:
• nonprofit-manager.php loads activation hooks and module files.
• includes/*.php classes and functions handle admin UI (Settings pages), business logic (Member management, Donations, Events), routing hooks (REST endpoints or admin_post).
• includes/email-newsletter/* manages email composition, queueing, template rendering, and reporting.
c. Data Storage:
• WP Options table for storing plugin settings (API keys, defaults).
• Possibly custom DB tables or custom post types for members, events, and queued emails (not explicitly shown, but implied).
d. Background Tasks:
• WP-Cron jobs trigger email delivery logic in includes/npmp-email-delivery.php and class-newsletter-tracker.php.
e. External Services:
• SMTP Server (configured via includes/email/smtp.php)
• PayPal API (npmp-paypal.php) – loaded in donation-form.js, invoked on form submission.
Architectural Patterns and Design Principles
• Modular design: each feature is encapsulated under includes/ with its own settings, UI, and business logic.
• Separation of concerns: frontend assets (blocks, JS) are kept separate from backend PHP.
• WordPress hook system: uses activation hooks, shortcodes, admin menus, WP-Cron, and possibly REST hooks.
• Extensibility: Gutenberg blocks, shortcode APIs, settings pages allow future extension.