Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Automatic add user to list after aprove account #312916
    Mark Gerritzen
    Participant

    I found the bug, it was because of a empty email. If I change the code to:

    $subscriber = Newsletter::instance()->get_user_by_wp_user_id($user_id);
    $user_data = get_userdata($user_id);

    $nl_user = array();
    $nl_user[‘id’] = $subscriber->id;
    $nl_user[’email’] = $user_data->user_email;
    $nl_user[‘status’] = ‘C’;
    $nl_user[‘list_2’] = 1;

    Newsletter::instance()->save_user($nl_user);

    Than the email is filled in and there will be no error.
    Thans for the help,
    Mark

    in reply to: Automatic add user to list after aprove account #311175
    Mark Gerritzen
    Participant

    Hi Stefano,

    Did you see my message? It is still not working, does no one knows how to solve this issue?

    Kind regards,
    Mark

    in reply to: Automatic add user to list after aprove account #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

    in reply to: Automatic add user to list after aprove account #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

Viewing 4 posts - 1 through 4 (of 4 total)