Forum Replies Created
-
AuthorPosts
-
Mark Gerritzen
ParticipantI 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,
MarkMark Gerritzen
ParticipantHi Stefano,
Did you see my message? It is still not working, does no one knows how to solve this issue?
Kind regards,
MarkMark Gerritzen
ParticipantHi 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,
MarkMark Gerritzen
ParticipantHi 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 -
AuthorPosts