As the title says. This message is loged everytime someone logs in on the website. Worse thing is, that the user fields are all deletes (except login values). So adress, phone, street, email... are all deleted.

I use Simplenews 6.x-2.x-dev (2010-03-24) with extra modules: Simplenews Content Selection 6.x-1.1 and Simplenews Scheduler 6.x-1.x-dev (2010-03-06)

I really hope someone can help me out.

Thanx

CommentFileSizeAuthor
#2 simplenews-757242.patch807 bytessutharsan

Comments

Imagone’s picture

Update: email field is not deleted.

sutharsan’s picture

Status: Active » Needs review
StatusFileSize
new807 bytes

Try the attached patch.

Imagone’s picture

Hi,

The patch indeed solved the invalid argument, but the problem of deleting the user fields, wasn't fixed. Then i noticed there were two orphaned actions cron couldn't execute.
Possible they were part of simplenews sheduler: 'simplenews_cron_action' and 'scs_views_create_newsletter_action'. After removing these actions and removing 'cron_semaphore' + 'cron_last' from my database (cause i couldn't run cron anymore) the problem seems to be solved.

Thanx for your help :-)

edit: the problem was solved but.... The invalid argument is solved but now ,after several tests, the deleting of user-fields reoccured. I have a feeling it has something to do with the simplenews scheduler. Though disabling that module did not solve the problem. I'm going to reïnstall Simplenews module and go for some testing (simplenews module only).

sutharsan’s picture

Patch #2 is committed. I keep the issue open for your test results.

xsean’s picture

when i try to delete the newsletter subscriber, it show me the error message below and it did not delete the selected subscriber.

* warning: array_filter() [function.array-filter]: The first argument should be an array in ../public_html/sites/all/modules/simplenews/simplenews.admin.inc on line 339.
* warning: Invalid argument supplied for foreach() in ../public_html/sites/all/modules/simplenews/simplenews.admin.inc on line 339.
* warning: Invalid argument supplied for foreach() in ../public_html/sites/all/modules/simplenews/simplenews.admin.inc on line 366.

Is this issue related to this bug?

sutharsan’s picture

No, not related. Pls create a new issue so we can keep track of different bugs.

sutharsan’s picture

Status: Needs review » Fixed

Closing...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

roball’s picture

Title: Invalid argument supplied for foreach() in .../public_html/sites/all/modules/simplenews/simplenews.module on line 834 » All user profile fields are deleted on login
Assigned: Imagone » Unassigned
Priority: Normal » Critical
Status: Closed (fixed) » Active

Unfortunately, I can confirm that *all* fields defined by Drupal core's Profile module gets deleted for a certain user once this user logs in and the message "You have been subscribed to [Newsletter-Name]." appears on top of user/[UID]. This still occurs with the latest 2.x dev (2010-May-20).

I have no related error messages in the log, thus can confirm Imagone's report in #3. The patch solved the PHP error but the worse thing of deleting all user profile fields is still there. I do NOT (and have never used) Simplenews scheduler, so it's unrelated to that module.

Problem goes away when I disable the Simplenews module and comes back when I re-enable it, so it is definitely related to Simplenews.

roball’s picture

Status: Active » Needs work

Just found out that the problematic code is in the block

        // If subscription data is processed, we update the user data to remove it.
        if ($processed) {
          user_save($account, $data);
        }

in "simplenews.module". Commenting out the line user_save($account, $data); solved the problem so far.

miro_dietiker’s picture

roball, something like user_save is needed here. If we don't save, simplenews will resubscribe the user after each login to the newsletters chosen on registration. (note the messages displayes about subscriptions occurred.)

Please test this situation (register, logout, login) and provide a patch that also resets the login-subscription action.

roball’s picture

I even have no self-registration allowed, but the annoying "You have been subscribed to [Newsletter-Name]." message appeares *every* time the user logged in, as well as the profile field values getting silently deleted. It seems that the whole logic belonging to case 'login' (currently beginning on line 777 of "simplenews.module") should be re-considered.

Removing user_save() solved the big problem of deleting the profile field values for me (the other issue still remains). Can you reproduce the problem?

roball’s picture

I am sorry to say, but this critical bug is really extreme dangerous! I would strongly recommend to comment out the line mentioned above (it is line 824 of "simplenews.module" v 1.220.2.32) until there is a solution. The damage this line does is much worse than what it is supposed to do. All your users having profile fields set will lose all the values when they login. Really BAD! The module could currently also be called "Profile fields killer". Sorry, but this critical bug really needs urgent attention - thanks for your understanding.

miro_dietiker’s picture

Bumping this also.
We need to fix 6--2 profile handling before releasing it.

roball’s picture

Status: Needs work » Fixed

I no longer see this problem with the latest 6.x-2.x-dev (2010-Sep-17).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.