AcyMailing
Our siteForumBlog
Latest version
Latest version
  • AcyMailing documentation
  • How to renew AcyMailing license?
  • How to switch AcyMailing license plan?
  • Setup AcyMailing
    • Update from AcyMailing 5
    • Installation
      • Download AcyMailing
      • Install AcyMailing
      • Update AcyMailing
      • Switching from Starter to a paid version
      • Uninstall AcyMailing
    • Move AcyMailing between websites
      • Migrate between Joomla! and WordPress
      • Move between two WordPress websites
      • Switch from Joomla 3 to Joomla 4/5
    • Configuration
      • License
      • Mail settings
        • Set up your DKIM : DomainKeys Identified Mail
        • Set up Oauth 2.0
      • Queue process
      • Configure your send process
      • Subscription
      • Bounce handling
      • Data collection
      • Security
      • Languages
    • Step by step guide
    • Multilingual websites
      • Translate AcyMailing
      • Custom translation
    • Subscription to your lists
      • Subscription form - Joomla
      • Subscription form - WordPress
      • Other subscription methods
      • RSForm!Pro integration
  • External sending methods
    • AcyMailing Sending Service
    • Amazon SES
    • ElasticEmail
    • Mailgun
    • Postmark
    • SendGrid
    • Brevo SMTP Relay
    • Brevo / Sendinblue (Legacy)
  • Main pages
    • Dashboard
    • Subscription forms
      • Subscription Form
      • Header
      • Footer
      • Popup
      • Shortcode (Wordpress)
    • Subscribers
      • Create a subscriber
      • Import subscribers
      • Export subscribers
    • Custom fields
      • Create Custom Field
      • Examples
    • Lists
      • Create a list
    • Segment
      • Edition
    • Emails
      • Creation of a campaign
        • Choose a template
        • Edit email
        • Recipients
        • Segment
        • Send settings
        • Tests
        • Summary
      • A/B testing
      • Automatic campaigns
      • Follow-up
        • Trigger
        • Condition
        • Emails
        • Summary
      • Special mails
    • The email editor
      • Tenor integration
      • Unsplash integration
    • Templates
      • Create a template
      • Import a template
    • Email overrides
      • Edition
    • Automations
      • Information
      • Conditions
      • Actions
      • Action targets
      • Summary
    • Scenario
      • Create a new Scenario
      • Performances
    • Queue
    • Statistics
      • Overview
      • Detailed Statistics
      • Click map
      • Links details
      • User click details
      • Statistics per list
    • Add-ons
    • Mailbox actions
      • Mailbox actions
        • Edition
      • Bounce rules
        • Configuration
        • Listing
        • Create bounce rules
  • Advanced
    • Send follow-up messages based on subscription
    • Let site users use AcyMailing
      • List management
      • User management
      • Campaigns management
    • Show an archive of the sent newsletters
    • Show a profile edition form on your site
    • Partner platform
      • Log in
      • Dashboard
      • Single domain details
  • Integrations
    • Settings
    • Joomla add-ons
      • Joomla articles
      • CB Subscriptions
      • Community Builder
      • Community Quiz
      • Community Surveys
      • Contacts
      • Dashboard Quick icon
      • Docman
      • DPCalendar
      • EasyBlog
      • EasyProfile
      • EasySocial
      • Event Booking
      • FLEXIcontent
      • HikaShop
      • iCagenda
      • JCal Pro
      • jDownloads
      • JEvents
      • JSW CRM
      • JTicketing
      • K2 Content
      • Membership Pro
      • Module
      • PayPlans
      • Phoca Download
      • RSEvents!Pro
      • Seblod
      • Shika
      • VirtueMart
      • Zoo
    • WordPress add-ons
      • WordPress posts and pages
      • Advanced Custom Fields (ACF)
      • Business Directory
      • Contact Form 7
      • Easy Digital Downloads
      • EventON
      • Events Manager
      • Gravity Forms
      • Learndash
      • MemberPress
      • Modern Events Calendar
      • The events calendar
      • Ultimate Member
      • Uncanny Automator
      • WooCommerce
    • All websites add-ons
      • Articles, posts and pages from WordPress and Joomla
      • Automation - export action
      • Create user
      • Custom headers
      • RSS and Atom feeds
      • Table of contents generator
      • Universal filter
    • Zapier
  • Developers
    • Developer Documentation
    • Making a custom add-on
      • Execute custom script on specific AcyMailing actions
      • Insert a dynamic text in an email for Joomla
      • Insert a custom block in an email for Joomla
      • Insert a dynamic text in an email for WordPress
      • Insert a custom block in an email for WordPress
    • Custom script using our code
    • Create a page override
    • Joomla quickstart package with AcyMailing
    • Customise inserted content
  • FAQ
    • Could not instantiate mail function - AcyMailing
    • Spam issue
    • Your send process is slow?
    • Compatibility issues
    • Mail archive not displaying special characters
Powered by GitBook
On this page
  • Creating my custom add-on
  • Adding features to your custom add-on
  1. Developers

Making a custom add-on

This page guides you into developing your own add-on to safely modify AcyMailing features.

AcyMailing has a lot of features, but it isn't integrated with every other extension. You may want to create your own custom add-on to:

  • insert dynamic texts in your emails (the current month, an event name, etc…)

  • insert user information in your emails (a custom field, a personal information, etc…)

  • automatically insert content built in other extensions (products, events, articles, etc…)

  • execute a script when a specific action is performed in AcyMailing (when a new user subscribes, when a user is imported, etc…)

Creating my custom add-on

First create the main folder for your add-on. It must be in lowercase with only letters: administrator/components/com_acym/dynamics/exampleaddon/

Inside this folder, create the file plugin.php like this one:

<?php

use AcyMailing\Core\AcymPlugin;

class plgAcymExampleaddon extends AcymPlugin
{
}

The class name MUST always be "plgAcym" followed by the folder name of your add-on, with a capital letter at the beginning.

First create the main folder for your WordPress plugin, for example wp-content/plugins/custom-add-on-for-acymailing/

In this folder, create the file custom-add-on-for-acymailing.php with the following content:

<?php
/*
 * Plugin Name: Custom add-on for AcyMailing
 * Description: Insert dynamic texts inside sent emails
 * Version: 1.0
 * Requires Plugins: acymailing
*/

use AcyMailing\Classes\PluginClass;

class myCustomAddonForAcyMailing
{
    const INTEGRATION_PLUGIN_NAME = 'plgAcymExampleaddon';

    private string $integrationName;

    public function __construct()
    {
        register_deactivation_hook(__FILE__, [$this, 'disable']);
        register_uninstall_hook(__FILE__, [$this, 'uninstall']);
        add_action('acym_load_installed_integrations', [$this, 'register'], 10, 1);

        $this->integrationName = strtolower(substr(self::INTEGRATION_PLUGIN_NAME, 7));
    }

    public function disable(): void
    {
        if (!$this->loadAcyMailingLibrary()) {
            return;
        }

        $pluginClass = new PluginClass();
        $pluginClass->disable($this->integrationName);
    }

    public function uninstall(): void
    {
        if (!$this->loadAcyMailingLibrary()) {
            return;
        }

        $pluginClass = new PluginClass();
        $pluginClass->deleteByFolderName($this->integrationName);
    }

    public function register(array &$integrations): void
    {
        $integrations[] = [
            'path' => __DIR__,
            'className' => self::INTEGRATION_PLUGIN_NAME,
        ];
    }

    private function loadAcyMailingLibrary(): bool
    {
        $ds = DIRECTORY_SEPARATOR;
        $vendorFolder = dirname(__DIR__).$ds.'acymailing'.$ds.'vendor';
        $initFile = dirname(__DIR__).$ds.'acymailing'.$ds.'back'.$ds.'Core'.$ds.'init.php';

        return file_exists($vendorFolder) && include_once $initFile;
    }
}

new myCustomAddonForAcyMailing();

You will need to modify:

  • your plugin name on line 3, that will be shown on your plugins listing

  • lines 11 and 64 to name the class however you like (make it something unique to avoid conflicts)

  • line 13 where the value MUST start with "plgAcym" and be followed by a capital letter then lowercase letters. ⚠️ Remember this value as it will be used as the class name of our add-on ⚠️

Create the file plugin.php in the same folder:

<?php

use AcyMailing\Libraries\acymPlugin;

class plgAcymExampleaddon extends acymPlugin
{
}

Notice that the class name MUST be the same you set in the previous file on line 13

Adding features to your custom add-on

Once your custom add-on's base files are created, you can add methods in the plugin.php file to customise AcyMailing features.

PreviousDeveloper DocumentationNextExecute custom script on specific AcyMailing actions

Last updated 5 months ago

Execute custom script on specific AcyMailing actions
Insert a dynamic text in an email for Joomla
Insert a custom block in an email for Joomla
Insert a dynamic text in an email for WordPress
Insert a custom block in an email for WordPress