Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Email signup fails when user is already a contact #59

Open
lopsided opened this issue Nov 10, 2017 · 0 comments
Open

Email signup fails when user is already a contact #59

lopsided opened this issue Nov 10, 2017 · 0 comments

Comments

@lopsided
Copy link

Hi,

We have several lists in sendgrid and our blog newsletter signup adds users to one. When the user is already a contact (as a result of being on one of the other lists) the newsletter signup fails with the general error template/msg: "Something went wrong while trying to send information."

I've debugged this and it looks like the issue is with the static add_recipient method of the class Sendgrid_NLVX in the file class-snedgrid-nlvx.php. In particular this bit:

    if ( ! isset( $recipient_response['persisted_recipients'] ) or ! isset( $recipient_response['persisted_recipients'][0] ) ) {
      return false;
    }

Since the api call returns unmodified_recipients=[0] when the email already exists as a contact, and persisted_recipients=[] this method is failing here.

In this case I guess we also need to fetch the recipient id from sendgrid for the existing contact/email and then we can proceed to add it to the correct list as per usual.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant