PolyCMS Visual Portal and Publishing Engine for RISE CRM

Build Custom Plugins for PolyCMS on RISE CRM

Modifying core PolyCMS files inside RISE CRM causes broken templates and merge conflicts on every update. Building an isolated custom plugin solves this by isolating your business logic, shortcodes, and admin routes inside a dedicated package. Using CodeIgniter 4 PSR-4 namespaces, strict entry guards, and PolyCMS action and filter hooks, your team ships upgrade-safe extensions managed directly through Plugin Manager.

If your plugin registers custom frontend display blocks, pair it with Widgets and Sidebars in PolyCMS for RISE CRM before packaging.

Plugin ComponentRecommended PatternOperational Benefit
Security GuardCheck defined('PLUGINPATH') at file topBlocks direct browser execution of PHP files
Manifest FileStructured plugin.json metadataEnables version checks and Plugin Manager UI cards
AutoloadingUnique CI4 PSR-4 namespace per slugPrevents class collisions across third-party add-ons
Hook IntegrationAction and filter callbacks on bootExtends content and headers without core edits
Lifecycle SafetySeparate deactivate and uninstall routinesPreserves data during debugging and cleans up on removal

1. Scaffold the Isolated Plugin Package

Create a dedicated subdirectory inside the PolyCMS plugins directory named after your lowercase slug. Keep a single bootstrap entry file that validates defined('PLUGINPATH') or exit('No direct script access allowed'); and registers your PSR-4 namespace cleanly with CodeIgniter 4 before loading controllers or helpers. After publishing initial content hooks, verify rendering flow using your first blog post workflow in PolyCMS.

  • Declare unique slug, version, and minimum PolyCMS requirement fields inside plugin.json.
  • Namespace all controllers, models, and services under a vendor prefix to avoid duplicate class names.
  • Scope custom CSS and JS assets inside a dedicated assets/ folder loaded only on target routes.

2. Register Hooks, Admin Routes, and Lifecycle Handlers

Hook into PolyCMS initialization events to register admin menu items, content filters, or custom shortcodes without touching RISE CRM core routes. Wrap database migrations inside idempotent table existence checks on activation, and keep deactivation non-destructive so administrators can toggle plugins safely during QA. Review PolyCMS troubleshooting patterns if routes return 404 after activation.

  • Validate RISE CRM staff permissions and CSRF tokens on every custom admin POST endpoint.
  • Register uninstall cleanup strictly inside the dedicated uninstall routine rather than the deactivate hook.
  • Package the final release zip with the plugin slug folder at archive root for one-click Plugin Manager uploads.

Common Pitfalls and Quick Fixes

  • Fatal class-not-found error on Linux hosting: Match PSR-4 folder and filename casing exactly to your namespace declarations (for example, Controllers/ with capital C).
  • Custom plugin styles breaking RISE CRM sidebar layout: Prefix all plugin CSS classes with your plugin slug and enqueue stylesheets only on plugin admin pages.
  • Stale routes after uploading an updated zip: Deactivate and reactivate the plugin inside Plugin Manager and clear CodeIgniter 4 route and view caches.

Frequently Asked Questions

Will upgrading PolyCMS overwrite my custom plugin files?

No. Because custom plugins live inside their own isolated subdirectory and declare hooks instead of editing core PolyCMS controllers or views, official PolyCMS and RISE CRM updates preserve your custom plugin code, database tables, and saved configuration safely across version upgrades.

How do I prevent unauthorized direct access to plugin PHP files?

Place the standard RISE CRM guard at line one of every PHP file in your plugin package, including language and helper files. Checking that PLUGINPATH is defined immediately aborts direct HTTP requests before any classes, queries, or view templates execute.

Should deactivating a plugin delete its custom database tables?

No. Deactivation should only disable hooks, routes, and frontend widgets while keeping database tables and settings intact for troubleshooting. Reserve schema drops and option cleanup exclusively for the explicit delete or uninstall action triggered by an administrator inside Plugin Manager.

Can a custom plugin add new shortcodes or sidebar widgets?

Yes. During plugin boot, you can register custom shortcode callbacks and widget classes through PolyCMS hook APIs. Once the plugin is active, content editors can place those widgets in theme sidebars or embed shortcodes inside blog posts and landing pages.


Comments

Leave a Reply

Your email address will not be published.Required fields are marked *