Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Find if the user is subscribed
  • Vote Up0Vote Down almaysalmays
    Posts: 23Sendy user
    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.
  • 5 Comments
  • Vote Up0Vote Down BenBen
    Posts: 3,507Sendy support
    I'll certainly add this API. Thanks for the suggestion!
  • Vote Up0Vote Down almaysalmays
    Posts: 23Sendy user
    Currently I decided to use "Already subscribed." response.
    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.
  • Vote Up0Vote Down almaysalmays
    Posts: 23Sendy user
    maybe unsubscribe.php:74 ?
  • Vote Up0Vote Down almaysalmays
    Posts: 23Sendy user
    Ok. It was just the list settings. Unsubscribe from all.
    Resolved.
  • Vote Up0Vote Down BenBen
    Posts: 3,507Sendy support
    Great that you worked around this so creatively.
This discussion has been closed.
All Discussions