Skip to content

Conversation

n7studios
Copy link
Contributor

Summary

Adds the add_subscriber_to_form() API function, to include support for first name, custom fields and tags, per https://developers.convertkit.com/#add-subscriber-to-a-form.

Outputs a PHP deprecated notice if using the existing form_subscribe(), function, as its second argument supports an array of options, whilst add_subscriber_to_form() provides the specific named arguments (form ID, email address, first name, custom fields), as we do for e.g. add_subscriber_to_sequence().

Adds tests to improve test coverage of new function arguments.

Testing

  • testAddSubscriberToForm: Test that adding a subscriber to a form works
  • testAddSubscriberToFormWithInvalidFormID: Test that adding a subscriber to an invalid form ID throws a ClientException
  • testAddSubscriberToFormWithInvalidEmailAddress: Test that adding a subscriber to a form with an invalid email address throws a ClientException
  • testAddSubscriberToFormWithFirstName: Test that adding a subscriber to a form with a first name specified works.
  • testAddSubscriberToFormWithCustomFields: Test that adding a subscriber to a form with a custom field works.
  • testAddSubscriberToFormWithTagID: Test that adding a subscriber to a form with a tag ID works.

Checklist

@n7studios n7studios added this to the 1.0.0 milestone Mar 20, 2023
@n7studios n7studios self-assigned this Mar 20, 2023
@n7studios n7studios requested review from a team, corydhmiller and noelherrick and removed request for a team March 20, 2023 15:32
@n7studios n7studios marked this pull request as ready for review March 20, 2023 15:32
# Conflicts:
#	src/ConvertKit_API.php
@n7studios n7studios merged commit dd2c992 into 1.0-beta Mar 22, 2023
@n7studios n7studios deleted the add-subscriber-to-form branch March 23, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants