Autoformat files with prettier
[MAILPOET-4075]
This commit is contained in:
@ -9,26 +9,27 @@ In MailPoet, subscribers are organized into lists. This method provides function
|
||||
It returns the new list. See [Get Lists](GetLists.md) for a list data structure description.
|
||||
|
||||
## Arguments
|
||||
|
||||
### `$list` (required)
|
||||
|
||||
An associative array which contains list data.
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| name (required) | string | 90 chars | A name of the list. |
|
||||
| description (optional) | string\|null| 250 chars | A description of the list. |
|
||||
| Property | Type | Limits | Description |
|
||||
| ---------------------- | ------------ | --------- | -------------------------- |
|
||||
| name (required) | string | 90 chars | A name of the list. |
|
||||
| description (optional) | string\|null | 250 chars | A description of the list. |
|
||||
|
||||
## Error handling
|
||||
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
Code of the exception is populated to distinguish between different errors.
|
||||
|
||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 14 | Missing list name |
|
||||
| 15 | Trying to create a list that already exists |
|
||||
| 16 | The list couldn’t be created in the database |
|
||||
| Code | Description |
|
||||
| ---- | -------------------------------------------- |
|
||||
| 14 | Missing list name |
|
||||
| 15 | Trying to create a list that already exists |
|
||||
| 16 | The list couldn’t be created in the database |
|
||||
|
@ -8,9 +8,9 @@ This method allows a subscriber to be created, adds them into lists, and handles
|
||||
|
||||
If sign-up confirmation (double opt-in) is enabled in the MailPoet settings a subscriber is created with status `unconfirmed` otherwise the status is set to `subscribed`.
|
||||
|
||||
- *A confirmation email* is an email which is sent to a subscriber so that they can confirm his subscription. It is sent only if sign-up confirmation is enabled in the MailPoet settings.
|
||||
- *A welcome email* is an automatic email which is sent to a new subscriber. This email is scheduled only if sign-up confirmation is disabled and a welcome email is configured for some of given lists. In case of required sign-up confirmation, it is scheduled later after a subscriber confirms the subscription.
|
||||
- *An admin notification email* is sent to the site admin to inform them about a new subscription. It is sent only if the notification feature is enabled in the MailPoet setting.
|
||||
- _A confirmation email_ is an email which is sent to a subscriber so that they can confirm his subscription. It is sent only if sign-up confirmation is enabled in the MailPoet settings.
|
||||
- _A welcome email_ is an automatic email which is sent to a new subscriber. This email is scheduled only if sign-up confirmation is disabled and a welcome email is configured for some of given lists. In case of required sign-up confirmation, it is scheduled later after a subscriber confirms the subscription.
|
||||
- _An admin notification email_ is sent to the site admin to inform them about a new subscription. It is sent only if the notification feature is enabled in the MailPoet setting.
|
||||
|
||||
All these emails can be disabled using `$options`.
|
||||
|
||||
@ -21,30 +21,33 @@ There might be other `\Exceptions` because of some invalid input data such a inv
|
||||
It returns a new subscriber. See [Get Subscriber](GetSubscriber.md) for a subscriber data structure.
|
||||
|
||||
## Arguments
|
||||
|
||||
### `$subscriber` (required)
|
||||
|
||||
An associative array containing subscriber data which contains default properties (email, first_name, last_name) and custom subscriber fields which were defined in MailPoet.
|
||||
It has to contain an email and all required custom fields. To get defined custom fields see [Get Subscriber Fields](GetSubscriberFields.md)
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| email (required) | string | 150 chars | a valid email address |
|
||||
| first_name (optional) | string/null | 255 chars | Fist name of the subscriber. |
|
||||
| last_name (optional) | string/null | 255 chars | Last name of the subscriber. |
|
||||
| cf_* (optional/required) | string/boolean/null | 65K chars | A custom field (see [Get Subscriber Fields](GetSubscriberFields.md)). <br> If a custom field is a checkbox, send truthy or falsy value (`true`/`false, `1`/`0` or `"1"`\`"0"`). |
|
||||
| Property | Type | Limits | Description |
|
||||
| -------------------------- | ------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| email (required) | string | 150 chars | a valid email address |
|
||||
| first_name (optional) | string/null | 255 chars | Fist name of the subscriber. |
|
||||
| last_name (optional) | string/null | 255 chars | Last name of the subscriber. |
|
||||
| cf\_\* (optional/required) | string/boolean/null | 65K chars | A custom field (see [Get Subscriber Fields](GetSubscriberFields.md)). <br> If a custom field is a checkbox, send truthy or falsy value (`true`/`false, `1`/`0`or`"1"`\`"0"`). |
|
||||
|
||||
### `$list_ids` (optional)
|
||||
|
||||
An array containing list ids into which subscriber will be added.
|
||||
In case that the list is empty a subscriber will be created; but sending a confirmation email, notification email and scheduling welcome email will be skipped.
|
||||
|
||||
### `$options` (optional)
|
||||
|
||||
All options are optional. If omitted a default value is used.
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| send_confirmation_email | boolean | true | Can be used to disable a confirmation email. Otherwise, a confirmation email is sent as described above. It is strongly recommended to keep this option set to `true` so that MailPoet settings for sign-up confirmation are respected. Turning it to `false` might lead that subscriber to be added as `unconfirmed`. |
|
||||
| schedule_welcome_email | boolean | true | Can be used to disable a welcome email. Otherwise, a welcome email is scheduled as described above.|
|
||||
| skip_subscriber_notification | boolean | false | Can be used to disable an admin notification email. Otherwise, an admin notification email is sent as described above.|
|
||||
| Option | Type | Default | Description |
|
||||
| ---------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| send_confirmation_email | boolean | true | Can be used to disable a confirmation email. Otherwise, a confirmation email is sent as described above. It is strongly recommended to keep this option set to `true` so that MailPoet settings for sign-up confirmation are respected. Turning it to `false` might lead that subscriber to be added as `unconfirmed`. |
|
||||
| schedule_welcome_email | boolean | true | Can be used to disable a welcome email. Otherwise, a welcome email is scheduled as described above. |
|
||||
| skip_subscriber_notification | boolean | false | Can be used to disable an admin notification email. Otherwise, an admin notification email is sent as described above. |
|
||||
|
||||
## Error handling
|
||||
|
||||
@ -55,9 +58,9 @@ An exception of base class `\Exception` can be thrown when something unexpected
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 11 | Missing email address |
|
||||
| 12 | Trying to create a subscriber that already exists |
|
||||
| 13 | The subscriber couldn’t be created in the database |
|
||||
| 17 | Welcome email failed to send |
|
||||
| Code | Description |
|
||||
| ---- | -------------------------------------------------- |
|
||||
| 11 | Missing email address |
|
||||
| 12 | Trying to create a subscriber that already exists |
|
||||
| 13 | The subscriber couldn’t be created in the database |
|
||||
| 17 | Welcome email failed to send |
|
||||
|
@ -11,77 +11,77 @@ See [Subscriber Fields for more details](GetSubscriberFields.md)
|
||||
|
||||
### `$data` (required)
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| name (required) | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type (required) | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params (optional) | array | - | Contains various information, see examples below. |
|
||||
| Property | Type | Limits | Description |
|
||||
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
|
||||
| name (required) | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type (required) | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params (optional) | array | - | Contains various information, see examples below. |
|
||||
|
||||
### `$params`
|
||||
|
||||
Params array differs for each type.
|
||||
The common properties for all types:
|
||||
Params array differs for each type.
|
||||
The common properties for all types:
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| Property | Type | Description |
|
||||
| -------- | ------ | ------------------------------------------------------------------------------------------- |
|
||||
| required | string | Indicates if the value must be provided for each subscriber. Possible values are: "1" or "" |
|
||||
| label | string | Label used for displaying the field to the end user. |
|
||||
| label | string | Label used for displaying the field to the end user. |
|
||||
|
||||
#### `$params` for text, textarea types
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| Property | Type | Description |
|
||||
| -------- | ------ | ------------------------------------------------------------------------------------------- |
|
||||
| validate | string | Can be used for validating input values. Possible values are: `number`, `alphanum`, `phone` |
|
||||
|
||||
#### `$params` for checkbox types
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| values | array | Same array as for radio type. Must contain exactly 1 element |
|
||||
| Property | Type | Description |
|
||||
| -------- | ----- | ------------------------------------------------------------ |
|
||||
| values | array | Same array as for radio type. Must contain exactly 1 element |
|
||||
|
||||
#### `$params` for radio, select types
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| values | array | Contains a list of options. Each element must contain a string `value` and can contain `is_checked` |
|
||||
| Property | Type | Description |
|
||||
| -------- | ----- | --------------------------------------------------------------------------------------------------- |
|
||||
| values | array | Contains a list of options. Each element must contain a string `value` and can contain `is_checked` |
|
||||
|
||||
#### `$params` for date type
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| date_type | string | Possible values are: Values: `year_month_day`, `year_month`, `month`, `day` |
|
||||
| Property | Type | Description |
|
||||
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| date_type | string | Possible values are: Values: `year_month_day`, `year_month`, `month`, `day` |
|
||||
| date_format | string | Values: for year_month_day: `MM/DD/YYYY`, `DD/MM/YYYY`, `YYYY/MM/DD`, for year_month: `YYYY/MM`, `MM/YY`, for year: `YYYY`, for month: `MM` |
|
||||
|
||||
## Response
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| id | string | 11 chars |Field Id |
|
||||
| name | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params | array | - | Contains various information, see examples below. |
|
||||
| created_at | string\|null | - | UTC time of creation in `Y-m-d H:i:s` format |
|
||||
| updated_at | string | - | UTC time of last update in `Y-m-d H:i:s` format |
|
||||
| Property | Type | Limits | Description |
|
||||
| ---------- | ------------ | -------- | ------------------------------------------------------------------------------------------------- |
|
||||
| id | string | 11 chars | Field Id |
|
||||
| name | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params | array | - | Contains various information, see examples below. |
|
||||
| created_at | string\|null | - | UTC time of creation in `Y-m-d H:i:s` format |
|
||||
| updated_at | string | - | UTC time of last update in `Y-m-d H:i:s` format |
|
||||
|
||||
## Error handling
|
||||
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
Code of the exception is populated to distinguish between different errors.
|
||||
|
||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 1 | The subscriber couldn’t be created in the database |
|
||||
| 1001 | Missing a mandatory field in the `$data` argument |
|
||||
| 1002 | A mandatory field in the `$data` argument has wrong type |
|
||||
| 1003 | `$params` is not an array |
|
||||
| 1004 | Attempting to create a field with an unknown type |
|
||||
| 1005 | Incorrect validate parameter for text type |
|
||||
| Code | Description |
|
||||
| ---- | ---------------------------------------------------------------------------------- |
|
||||
| 1 | The subscriber couldn’t be created in the database |
|
||||
| 1001 | Missing a mandatory field in the `$data` argument |
|
||||
| 1002 | A mandatory field in the `$data` argument has wrong type |
|
||||
| 1003 | `$params` is not an array |
|
||||
| 1004 | Attempting to create a field with an unknown type |
|
||||
| 1005 | Incorrect validate parameter for text type |
|
||||
| 1006 | Passing a `values` array for the checkbox type that has incorrect number of values |
|
||||
| 1007 | Incorrect `date_format` value |
|
||||
| 1008 | Incorrect `date_type` value |
|
||||
| 1009 | Missing `values` for select or radio types |
|
||||
| 1010 | Empty `value` for select or radio types |
|
||||
| 1007 | Incorrect `date_format` value |
|
||||
| 1008 | Incorrect `date_type` value |
|
||||
| 1009 | Missing `values` for select or radio types |
|
||||
| 1010 | Empty `value` for select or radio types |
|
||||
|
@ -8,17 +8,18 @@ In MailPoet, subscribers are organized into lists. This method returns an array
|
||||
|
||||
### A list data structure
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| id | string | 11 chars | Id of the list |
|
||||
| name | string | 90 chars | Name of the list |
|
||||
| type | string | - | Type of the list. Currently, there is only one supported value: `default` |
|
||||
| description | string | 250 chars | Description of the list |
|
||||
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
| deleted_at | string\|null | - | This property is not null only when the list is in the trash. It contains UTC time in 'Y-m-d H:i:s' format. |
|
||||
| Property | Type | Limits | Description |
|
||||
| ----------- | ------------ | --------- | ----------------------------------------------------------------------------------------------------------- |
|
||||
| id | string | 11 chars | Id of the list |
|
||||
| name | string | 90 chars | Name of the list |
|
||||
| type | string | - | Type of the list. Currently, there is only one supported value: `default` |
|
||||
| description | string | 250 chars | Description of the list |
|
||||
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
| deleted_at | string\|null | - | This property is not null only when the list is in the trash. It contains UTC time in 'Y-m-d H:i:s' format. |
|
||||
|
||||
### Response Example
|
||||
|
||||
```php
|
||||
<?php
|
||||
[
|
||||
|
@ -7,45 +7,49 @@
|
||||
This method throws an `\Exception` in the event a subscriber with a given email address doesn’t exist.
|
||||
|
||||
## Arguments
|
||||
| Argument | Type | Description |
|
||||
| --- | --- | --- |
|
||||
|
||||
| Argument | Type | Description |
|
||||
| ----------------- | ------ | --------------------- |
|
||||
| $subscriber_email | string | a valid email address |
|
||||
|
||||
## A subscriber data structure
|
||||
|
||||
### Subscriber
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| id | string | 11 chars | Id of the subscriber |
|
||||
| wp_user_id | string\|null | 20 chars | Id of a WordPress user associated with the subscriber |
|
||||
| is_woocommerce_user | string | - | A flag telling whether the user is also a WooCommerce customer. Possible values are: `1`, `0` |
|
||||
| first_name | string | 255 chars | Fist name of the subscriber. |
|
||||
| last_name | string | 255 chars | Last name of the subscriber. |
|
||||
| email | string | 150 chars | Email address of the subscriber. |
|
||||
| status | string | - | Status of the subscriber. Possible values are: `unconfirmed`, `subscribed`, `unsubscribed`, `bounced`, `inactive` |
|
||||
| subscribed_ip | string\|null | 45 chars | An IP address used for subscription. |
|
||||
| confirmed_ip | string\|null | 45 chars | An IP address used for confirmation. |
|
||||
| confirmed_at | string\|null | - | UTC time of subscription confirmation in 'Y-m-d H:i:s' format |
|
||||
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
| deleted_at | string\|null | - | This property in not null in case that list is in trash and contains UTC time in 'Y-m-d H:i:s' format. |
|
||||
| unconfirmed_data | string\|null | 65K chars | May contain serialized subscriber data in case when there are pending changes waiting for a confirmation from a subscriber |
|
||||
| source | string\|null | - | Possible values: `form`,`imported`,`administrator`,`api`,`wordpress_user`,`woocommerce_user`,`woocommerce_checkout`,`unknown`)
|
||||
| count_confirmations | string | 11 chars | Counter for confirmation emails |
|
||||
| subscriptions | array | - | List of subcriber subscriptions |
|
||||
| cf_{custom_field['id']}| string | 65K chars | A custom subscriber field value (see [Get Subscriber Fields](GetSubscriberFields.md)|
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| ------------------------ | ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| id | string | 11 chars | Id of the subscriber |
|
||||
| wp_user_id | string\|null | 20 chars | Id of a WordPress user associated with the subscriber |
|
||||
| is_woocommerce_user | string | - | A flag telling whether the user is also a WooCommerce customer. Possible values are: `1`, `0` |
|
||||
| first_name | string | 255 chars | Fist name of the subscriber. |
|
||||
| last_name | string | 255 chars | Last name of the subscriber. |
|
||||
| email | string | 150 chars | Email address of the subscriber. |
|
||||
| status | string | - | Status of the subscriber. Possible values are: `unconfirmed`, `subscribed`, `unsubscribed`, `bounced`, `inactive` |
|
||||
| subscribed_ip | string\|null | 45 chars | An IP address used for subscription. |
|
||||
| confirmed_ip | string\|null | 45 chars | An IP address used for confirmation. |
|
||||
| confirmed_at | string\|null | - | UTC time of subscription confirmation in 'Y-m-d H:i:s' format |
|
||||
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
| deleted_at | string\|null | - | This property in not null in case that list is in trash and contains UTC time in 'Y-m-d H:i:s' format. |
|
||||
| unconfirmed_data | string\|null | 65K chars | May contain serialized subscriber data in case when there are pending changes waiting for a confirmation from a subscriber |
|
||||
| source | string\|null | - | Possible values: `form`,`imported`,`administrator`,`api`,`wordpress_user`,`woocommerce_user`,`woocommerce_checkout`,`unknown`) |
|
||||
| count_confirmations | string | 11 chars | Counter for confirmation emails |
|
||||
| subscriptions | array | - | List of subcriber subscriptions |
|
||||
| cf\_{custom_field['id']} | string | 65K chars | A custom subscriber field value (see [Get Subscriber Fields](GetSubscriberFields.md) |
|
||||
|
||||
### Subscriber's subscription
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| id | string | 11 chars | Id of relation |
|
||||
| subscriber_id | string | 11 chars | Id of subscriber |
|
||||
| segment_id | string | 11 chars | Id of a list |
|
||||
| status | string | - | Status of a subscription for the list. Possible values: `subscribed`, `unsubscribed` |
|
||||
| created_at | string | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------ |
|
||||
| id | string | 11 chars | Id of relation |
|
||||
| subscriber_id | string | 11 chars | Id of subscriber |
|
||||
| segment_id | string | 11 chars | Id of a list |
|
||||
| status | string | - | Status of a subscription for the list. Possible values: `subscribed`, `unsubscribed` |
|
||||
| created_at | string | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||
|
||||
### Response Example
|
||||
|
||||
```php
|
||||
<?php
|
||||
[
|
||||
@ -90,13 +94,13 @@ This method throws an `\Exception` in the event a subscriber with a given email
|
||||
|
||||
## Error handling
|
||||
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
Code of the exception is populated to distinguish between different errors.
|
||||
|
||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 4 | Asking for a subscriber that does not exist. |
|
||||
| Code | Description |
|
||||
| ---- | -------------------------------------------- |
|
||||
| 4 | Asking for a subscriber that does not exist. |
|
||||
|
@ -11,14 +11,15 @@ See also [addSubscriberField function.](AddSubscriberField.md)
|
||||
|
||||
## Subscriber Field
|
||||
|
||||
| Property | Type | Limits | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| id | string | 11 chars |Field Id |
|
||||
| name | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params | array | - | Contains various information, see examples below. |
|
||||
| Property | Type | Limits | Description |
|
||||
| -------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
|
||||
| id | string | 11 chars | Field Id |
|
||||
| name | string | 90 chars | Human readable name. Intended to be used, as an example, as a label for form input. |
|
||||
| type | string | - | Type of the field. Possible values are: `text`, `date`, `textarea`, `radio`, `checkbox`, `select` |
|
||||
| params | array | - | Contains various information, see examples below. |
|
||||
|
||||
## Response Example
|
||||
|
||||
```php
|
||||
<?php
|
||||
[
|
||||
|
@ -6,46 +6,50 @@
|
||||
|
||||
This method allows adding an existing subscriber into lists and handles confirmation email and admin notification email sending.
|
||||
|
||||
- *A confirmation email* is an email which is sent to a subscriber so they can confirm their subscription. It is sent only if sign-up confirmation is enabled in MailPoet settings and subscriber has not received any confirmation email yet.
|
||||
- *A welcome email* is an automatic email which is sent to a new subscriber. This email is scheduled only if sign-up confirmation is disabled and some welcome email is configured for some of given lists.
|
||||
- *An admin notification email* is sent to the site admin to inform them about a new subscription. It is sent only if the notification feature is enabled in the MailPoet setting.
|
||||
- _A confirmation email_ is an email which is sent to a subscriber so they can confirm their subscription. It is sent only if sign-up confirmation is enabled in MailPoet settings and subscriber has not received any confirmation email yet.
|
||||
- _A welcome email_ is an automatic email which is sent to a new subscriber. This email is scheduled only if sign-up confirmation is disabled and some welcome email is configured for some of given lists.
|
||||
- _An admin notification email_ is sent to the site admin to inform them about a new subscription. It is sent only if the notification feature is enabled in the MailPoet setting.
|
||||
|
||||
All these emails can be disabled using `$options`.
|
||||
|
||||
It returns a subscriber. See [Get Subscriber](GetSubscriber.md) for a subscriber data structure.
|
||||
|
||||
## Arguments
|
||||
|
||||
### string `$subscriber_id` (required)
|
||||
|
||||
An id or an email address. An `\Exception` is thrown when the value doesn't match any subscriber.
|
||||
|
||||
### array `$list_ids` (required)
|
||||
|
||||
An array of list ids. An `\Exception` is thrown if any of list ids are invalid. In such a case the subscriber isn't added to any list.
|
||||
|
||||
### array `$options` (optional)
|
||||
|
||||
All options are optional. If omitted, a default value is used.
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| send_confirmation_email | boolean | true | Can be used to disable confirmation email. Otherwise, a confirmation email is sent as described above.|
|
||||
| schedule_welcome_email | boolean | true | Can be used to disable welcome email. Otherwise, a welcome email is scheduled as described above.|
|
||||
| skip_subscriber_notification | boolean | false | Can be used to disable an admin notification email. Otherwise, an admin notification email is sent as described above.|
|
||||
| Option | Type | Default | Description |
|
||||
| ---------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| send_confirmation_email | boolean | true | Can be used to disable confirmation email. Otherwise, a confirmation email is sent as described above. |
|
||||
| schedule_welcome_email | boolean | true | Can be used to disable welcome email. Otherwise, a welcome email is scheduled as described above. |
|
||||
| skip_subscriber_notification | boolean | false | Can be used to disable an admin notification email. Otherwise, an admin notification email is sent as described above. |
|
||||
|
||||
## Error handling
|
||||
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
Code of the exception is populated to distinguish between different errors.
|
||||
|
||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 3 | No lists provided |
|
||||
| 4 | Invalid subscriber that does not exist |
|
||||
| 5 | Invalid list that does not exist |
|
||||
| 6 | Trying to subscribe to a WordPress Users list |
|
||||
| 7 | Trying to subscribe to a WooCommerce Customers list |
|
||||
| 8 | Trying to subscribe to a list that doesn’t support that |
|
||||
| 10 | Confirmation email failed to send |
|
||||
| 17 | Welcome email failed to send |
|
||||
| Code | Description |
|
||||
| ---- | ------------------------------------------------------- |
|
||||
| 3 | No lists provided |
|
||||
| 4 | Invalid subscriber that does not exist |
|
||||
| 5 | Invalid list that does not exist |
|
||||
| 6 | Trying to subscribe to a WordPress Users list |
|
||||
| 7 | Trying to subscribe to a WooCommerce Customers list |
|
||||
| 8 | Trying to subscribe to a list that doesn’t support that |
|
||||
| 10 | Confirmation email failed to send |
|
||||
| 17 | Welcome email failed to send |
|
||||
|
@ -9,26 +9,29 @@ This method removes a subscriber from given lists.
|
||||
It returns a subscriber. See [Get Subscriber](GetSubscriber.md) for a subscriber data structure.
|
||||
|
||||
## Arguments
|
||||
|
||||
### string `$subscriber_id` (required)
|
||||
|
||||
An id or email of an existing subscriber. An `\Exception` is thrown when an id or email doesn't match any subscriber.
|
||||
|
||||
### array `$list_ids` (required)
|
||||
|
||||
An array of list ids. An `\Exception` is thrown if any of list ids are invalid. In such a case the subscriber remains subscribed to all lists.
|
||||
|
||||
## Error handling
|
||||
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
||||
Code of the exception is populated to distinguish between different errors.
|
||||
|
||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
||||
|
||||
Codes description:
|
||||
|
||||
| Code | Description |
|
||||
| --- | --- |
|
||||
| 3 | No lists provided |
|
||||
| 4 | Invalid subscriber that does not exist |
|
||||
| 5 | Invalid list that does not exist |
|
||||
| 6 | Trying to subscribe to a WordPress Users list |
|
||||
| 7 | Trying to subscribe to a WooCommerce Customers list |
|
||||
| 10 | Confirmation email failed to send |
|
||||
| Code | Description |
|
||||
| ---- | --------------------------------------------------- |
|
||||
| 3 | No lists provided |
|
||||
| 4 | Invalid subscriber that does not exist |
|
||||
| 5 | Invalid list that does not exist |
|
||||
| 6 | Trying to subscribe to a WordPress Users list |
|
||||
| 7 | Trying to subscribe to a WooCommerce Customers list |
|
||||
| 10 | Confirmation email failed to send |
|
||||
|
Reference in New Issue
Block a user