MailPoet Newsletters
[resolved] Add / Remove subscriber via PHP (8 posts)

  1. ceruleus
    Posted 2 years ago #

    Hi there. I would like to know how can I add / remove user to the subscribers list?
    I looked at the examples here and made some function which I call after verifying data of the whole form. I tried to find some reference manual, to see which method is for what and which objects are for what, but without success.
    One more thing - I will need one function for removing the user - but I have no idea how to do that since I don't know which method is for what (and what methods are existing).

    Here is my function:

    function processMyWysija($idTmp){
    	// $idTmp is id of WP user - it's successfully passed here.
    	$idTmp = intval($idTmp);
    	$userData = get_userdata($idTmp);
    	$modelList = &WYSIJA::get('list','model');
    	$wysijaLists = $modelList->get($dataList);
    	$arrlist = array();
    	foreach($wysijaLists as $list){
    		$arrlist[] = $list['list_id'];
        print_r($userHelper); // here I expected some methods or something, only I got is WYSIJA_help_user Object ( ).

    Any help is appreciated. Thanks in advance!


  2. ceruleus
    Posted 2 years ago #

    Sorry, I forgot to say the main thing -_-' This function DOESN'T work. There is no any PHP error, or some echoed / printed error. Just, this function doesn't add an user to a list.

  3. Ben
    Plugin Author

    Posted 2 years ago #

    Well you need to hook that function so that it gets triggered.
    It's all in that guide : http://support.wysija.com/knowledgebase/plugin-form-integrate/

    The hook is something like that : add_action('init','processMyForm');


  4. JackWisdom
    Posted 2 years ago #

    Do you know how to remove subscribers without php? I'm using WordPress 3.5.1 don't believe I'm using a plugin for subscribers. Any ideas?


  5. MailPoet Staff
    Plugin Author

    Posted 2 years ago #

    Jack, you're trying to remove or delete Wysija subscribers?

    You can do that directly in the plugin. Look for the batch actions in the drop down menu.

  6. JackWisdom
    Posted 2 years ago #

    Thanks for your reply. It's not in the wysija plugin, it's through JetPack Blog Subscriptions. Any ideas?

    Thanks ahead of time!

  7. amistad18
    Posted 2 years ago #

    Jack, if you were gathering your subscribers through JetPack, then you should ask your question here:

  8. poco06
    Posted 1 year ago #

    Hello ceruleus,

    Did you find the way to add subscriber with a hook (and make it working !)?
    I just need to affect a subscriber to a specific list and would like to know what's the best code for this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MailPoet Newsletters
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic