mycred_email_instances

Description

This filter allows you to add / remove or adjust email instances that is selectable when creating or editing an email notice.

Available since version 1.1

Description

Param Type Required Description
$instances array Yes

An associative array of grouped email instances.


Instances

Email instances are presented in groups. For example gaining or loosing points are both part of the “General” instance. myCRED groups instances by add-on, so there is one group for “Transfers” which contains two instances: receiving points and sending points.

When you add your own instance, you must select between adding your own group (even if you only want to add one instance) or add your unique instance into an existing group.


Instance Example

Array
(
    [general] => Array
        (
            [label] => General
            [all] => users balance changes
            [positive] => user gains %_plural%
            [negative] => user lose %_plural%
            [zero] => users balance reaches zero
            [minus] => users balance goes minus
            [end] => 
        )

)

When adding your own group, the settings array must contain at minimum 3 items:

  • label – The label shown in the dropdown menu when editing an email notice. This must always be the first item in the array.
  • yourinstance – A unique ID identifying your custom instance.  This ID is then used by you when you need to identify an instance that should trigger these type of emails.
  • end – Always the last item in the array, this item indicates the end of the group. Left for backwards compatibility.

You might have noticed from the above example that the instance labels are always lowercase. This is because your label will be appended after the sentence: “Send email notice when …”. For example: “Send email notice when … users balance changes”.

Used By

Package Prio. Description
Not used by any built-in package.

Examples

Example 1: Add a custom email instance for when a users balance reaches 1000 points. Insert the instance under the “General“ group.