Find if the user is subscribed
I am using sendy as a mailing backend for my rails application.
On my site I have my own form, where user can switch on the checkboxes of the mailing lists he wants to be subscribed to.
After the checkbox is switched on/off I can subscribe/unsubscribe the user from the given mailing list with sendy API.
That's great.
But! Is there a way to find out if user is already subscriber to a given list or not — to set the default state of my checkboxes? There is no such call in the api. Maybe I can make direct mysql call, but then there is a problem, that I have my rails and php stuff on different machines, so I am not sure if I can open up a socket to alien mysql server? API call would be great.
On my site I have my own form, where user can switch on the checkboxes of the mailing lists he wants to be subscribed to.
After the checkbox is switched on/off I can subscribe/unsubscribe the user from the given mailing list with sendy API.
That's great.
But! Is there a way to find out if user is already subscriber to a given list or not — to set the default state of my checkboxes? There is no such call in the api. Maybe I can make direct mysql call, but then there is a problem, that I have my rails and php stuff on different machines, so I am not sure if I can open up a socket to alien mysql server? API call would be great.
This discussion has been closed.
Comments
It works.
I subscribe a user to the list. If user is subscribed, then I get "Already subscribed." and happily set $my_subscribed to true.
If in the subscribe response I don't get "Already subscribed.", then I know that user was not subscribed and set $my_subscribed to false. Then I need to unsubscribe a user from the list to restore initial state.
But here I get a surprise. When I unsubscribe a user from a list, then user gets unsubscribed from all lists. I checked the post parameters. 'list' field is there and is correct.
Resolved.