Home Forums Newsletter Plugin Support Automatic add user to list after aprove account

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #308397
    Mark Gerritzen
    Participant

    Hi,

    I use Ultimate member and the Newsletter plugin, users that register has to be approved by a admin. After that the user should be automaticly added to a certain list, is that possible? Or can I maybe write a script to update the usermeta after approve.

    Hope someone can help me,
    Kind regards,
    Mark Gerritzen

    #308444
    Stefano
    Keymaster

    After approval you should retrieve the subscriber ($subscriber = Newsletter::instance()->get_user_by_wp_user_id(…)) and than change and save the subscriber:
    $subscriber->list_4 = ‘1’;
    Newsletter::instance()->save_user($subscriber).

    #308885
    Mark Gerritzen
    Participant

    Hi Stefano,

    Sorry for my late reaction I was very busy with other projects. I will try the option you said. Thank you for that, if it won’t work I will come back here.

    Kind regards,
    Mark Gerritzen

    #308890
    Mark Gerritzen
    Participant

    Hi Stefano,

    I tried what you said, I also changed your code after finding something in the docs. I used both codes but they give me the same error, see below:

    $subscriber = Newsletter::instance()->get_user($user_id);
    $subscriber->list_2 = ‘1’;
    Newsletter::instance()->save_user($subscriber);

    Also when I first declare the newsletter as object it isn’t working. You said it had to be get_user_by_wp_user_id() but the documentation says get_user, but both methods work.

    I get the following error when approving the user:
    Database error. If you were saving a newsletter try a table upgrade from the status panel.

    I hope you see what’s happening,
    Kind regards,
    Mark

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.