Autoformat files with prettier

[MAILPOET-4075]
This commit is contained in:
Jan Jakes
2022-04-08 14:44:12 +02:00
committed by Veljko V
parent 2506ff5490
commit ab27eaee2d
592 changed files with 17992 additions and 12047 deletions

View File

@@ -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 couldnt 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 couldnt be created in the database |
| 17 | Welcome email failed to send |