Hi,

I have verion 6.x-1.x-dev of the php integration module. Everything is connecting ok, and for existing users subscribing and unsubscribing to my lists works a treat both ways (on sync).

However, a new user, when added to drupal behaves as follows:

- user is automatically 'subscribed' on registration in drupal (as desired)
- if i then log out and log back in as admin and examine this user in drupal he is indeed subscribed ('unsubcribe' appears next to the mailing list)
- On hitting 'synchronise users' the user appears in phplist, but is NOT subscribed to the list
- The user is now UNSUBSCRIBED in drupal too

Any help would be greatly appreciated.

PS. I know this is a separate issue, but is is possible to sync this eventually using cron?

Comments

paulbeaney’s picture

Hi,

The "Synchronise users" button is only designed to be used ONCE when you first install the PHPlist module on a copy of Drupal with an existing user base. It simply does a bulk sync of all users at that point, hence why there is no cron job.

All subsequent (un)subcription changes within user accounts are automatically fed back to PHPlist without any further intervention on your part. In fact, even if Drupal hasn't been synched with PHPlist, a user can still manage their subscriptions as their record (only) will be synced to PHPlist if it doesn't already exist.

That said, doing a "Sync users" later on *shouldn't* wipe any existing subscriptions - can you confirm whether this is the case please?

Regards,

- Paul

Dozzer7’s picture

Ok, thanks for the reply. In this case I have TWO problems now :-(

Firstly, the original problem...on the initial synchronisation (done just once at the beginning) any user that has chosen to be subscribed to a mailing list in Drupal does not get subscribed in PHPList. (perhaps it is not designed to do this and only syncs users and not their subscriptions??)

Secondly, any new sign ups on the Drupal side DO NOT automatically get added to PHPList even if they have subscribed to a newsletter (on initial registration, in my test example I selected 2 mailing lists on registration). HOWEVER, if I go back in to that newly created record in Drupal user management and look at 'My Newsletters' I see that drupal has NOT actually signed me up for the second and only the first has 'unsubscribe' ......so I hit 'subscribe' to the second one, and hey presto, a record appears in PHPList. BUT, the problem is PHPList only gets the message to subscribe to the second mailing list, so now both Drupal and PHPList have me NOT SUBSCRIBED to the first list!

Basically it looks like it all works except for something that has happened since I installed PHPList integratot that fails to subscribe you to mailing lists on the initial registration.

Some other useful information: I have user profiles activated but have NO extra fields, it seems to make no difference if I have 'Automatically subscribe users to first listed newsletter' on or off, both newsletters are ticked by default on registration.

Any other help would be greatly appreciated.

Dom

paulbeaney’s picture

I have completely re-worked the code in hook_user and tweaked _phplist_manage_subscription() in the D6-DEV module. Feel free to download and test.

Regards,

- Paul

Tmanagement’s picture

A bit related is my problem,

New users should be registered to phplist and then to a particular list. Users are indeed placed in phplist but not assigned to the list mentioned in Drupal. Furthermore, unsubscribing is possible but subscribing not, it wil return the following sentence "You do not have permission to subscribe to this list". This is de case even for the super user and after I have checked that all permissions on the module side and within drupal permissions are set all open.

paulbeaney’s picture

Hi,

I have just tested this scenario with the latest D6-DEV and it works. Please confirm if the problem still exists for you?

Regards,

- Paul

paulbeaney’s picture

Assigned: Unassigned » paulbeaney
Status: Active » Needs review

Slight correction: I have found the bug for auto-subscribing on sign-up and I think it is corrected, although I haven't had time yet to test every single scenario (admin-created account, public-created account requiring admin approval, instantly-activated public-created account...

If someone could take some time to test the different scenarios, that would be most helpful.

Regards,

- Paul

julient’s picture

Here is one case that doesn't work.
I registered as a new user on Drupal.
Upon account creation, I get a confirmation message (debug is on) that a user was created in phplist, which is good.
Then I get a Drupal warning: warning: Invalid argument supplied for foreach() in /path_to_root/httpdocs/sites/all/modules/phplist/phplist.module on line 482.
I then login with that user. I can see the list (there is only one) from the My Account tab, but the user hasn't been automatically subscribed to it.
Other functions (synch, subscribe, unsubscribe) work very well.

Regards,
Julien

chetanprakashsharma’s picture

Hi Paul,

I am new to Drupal.

I am facing problem in integrating PHPList in Drupal.

I have installed PHPList from : Administer->Site building ->Module->PHPList.

I have changed the permission of the Authenticated User for PHP List.

But it's not coming on My Account Tab.

Also when i created a new user from Drupal->User->Add New User : User has been created in drupal but it's not inserting newly added user to PHPList Users.

When i go to add new user page in drupal: this error is coming:
warning: Invalid argument supplied for foreach() in C:\wamp\www\drup2\sites\all\modules\phplist\phplist.module on line 1254.

In the mailing list section of Add User: "Subscribe me to:" caption is coming but checkbox is not coming...... i don't know how can i solve this problem...

Please help me out..

Regards,
Chetan

chrispeat’s picture

I have another related issue: When I upload a set of student member 'nodes' i have a set of rules that invoke a new user to be created of the new nodes, but the PHPList module hook (phplist_user) isnt being invoked. Any ideas why or how I can call it? This is a pretty big area of how we work so for it to work like this is really useful. Also this doesnt work if we just create a new student member 'node' so its not to do with the import but rather the call of the hook?

Happy to try and help, just getting to grips with it all.

Wonderful Module! Thanks!

Chris :-)

jakedeg’s picture

Status: Needs review » Needs work

I am running the newest dev version and I am still geting the foreach error described above. Everything else seems to be working perfectly. And even when I get the error, the user is still subscribed properly. My error says:

warning: Invalid argument supplied for foreach() in /home/nydac02/public_html/sites/all/modules/phplist/phplist.module on line 624.

Any new developments on this front?

Thanks!

paulbeaney’s picture

Hi,

The "Sync users" link is really only designed to be used for initially populating your PHPlist database after installing this module on your Drupal host. You shouldn't need to use it after that - as you rightly point out, your new user is correctly subscribed in PHPlist after being created and so syncing again would serve no purpose.

Maybe I need to remove that option once it has been run once...?

Regards,

- Paul

moyoda’s picture

I still see this problem:

During registration in Drupal (admin approval required) when the user selects a newsletter list -> the user does get created at phplist but is not assigned to the wanted list.

If the user is logged in - they can subscribe/ unsubscribe just fine on their user-page.

Any thoughts on this?

---
From debug:
•Looking up PHPlist id for email user89@site.dk
•Created phplistid for email user89@site.dk
•Found phplistid [] for email user89@site.dk
•Failed to update email newsletter subscription.
•Email: user89@site.dk, phpid: , ListID: 4, Sub: 4
•Din adgangskode og yderligere forklaring er blevet sendt til din e-mail-adresse. [Drupal standard in danish ~ Password and info is mailed to you]

paterik’s picture

you've to change the '_phplist_lookup_phplistid()' method,
the current version will allways return a 'null'/empty id for
previously generated (new) users, so this new users cant
be placed in user-to-newsletter-lists by system during the
_phplist_manage_subscription() method-call.

// if (isset($id[$email])) return $id[$email]; // old
if ((isset($id[$email])) && ($id[$email]!='')) return $id[$email]; // new

moyoda’s picture

I kind a had the feeling that it would return an empty id no matter what.

And you're absolutely right - That new line fixes it. Thanks a lot.

Very nice :-)

paulbeaney’s picture

Status: Needs work » Fixed

Thanks paterik,

I've made the change in 6.x-DEV - the download should update soon.

Regards,

- Paul

Status: Fixed » Closed (fixed)

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