• Resolved jbx

    (@jbx)


    Is there a PHP function I can use to add a new subscriber programmatically?

    I have another form (in another plugin) for which I am collecting the user’s email address. And I have a hook available to know when the form is submitted (and I can also add a custom checkbox such as ‘Subscribe me to the newsletter’). What I am missing however is the subscription part after collecting the email address.

    I tried to follow the code in add.php and it seems that it is saving a subscriber using NewsletterUsers::instance()->save_user($subscriber), however I am not sure if it is safe to use from my own functions.php and whether there is any special considerations I need to take care of, like compulsory fields, API key etc.

    https://ww.wp.xz.cn/plugins/newsletter/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Add new subscriber through PHP’ is closed to new replies.