I really like the new features ind version 1.3, thanks a lot.

My next feature request is a function to make subscribtion to all users with at specific role.
And maybe at list of subscribers :-)

I really hope that some day my Drupal/php knowledge is getting to a level where I can contribute with developing modules.

CommentFileSizeAuthor
#5 rolesubscribe.png174.83 KBMike Wacker

Comments

Mike Wacker’s picture

Makes sense to associate user roles w/ a subscription. It would be a handy tool for managing subscriptions.

Could you clarify what you mean by a list of subscibers a bit more?

In terms of role subscribe, obviously you could have multiple roles w/ different subscription options. The best way I see to handle this is to subscribe someone to a section if one or more of the roles is subscribed to that section.

(E.g.: User has roles 1 and 2. Role 1 is subscribed to sections 1 and 2. Role 2 is subscribed to sections 2 and 3. Hence, user is subscribed to sections 1, 2, and 3.)

In terms of giving the user flexibility to customize their subscription, I see two viable options.

  1. User is subscribed to any sections their roles are subscribed to, plus any sections the user individually subscribes to
  2. User can override the default subscription for their roles and add or take away any sections
styrbaek’s picture

I'm using Simplenews at the moment and it has a list of subscribers. My site is at local newspaper portal, so I like to se who is subscribing my newsletter :-)

Maybe the list could be made by views??

It would be nice if I could subscribe all the users in a specific role to my Sunmailer Newsletter.

My current newsletter contains content from multiple content-types, so it will be obvious to use sections, but I want to style the sections differently and this is my next issue.

Mike Wacker’s picture

Ah I see, so there are 2 separate feature requests.

  1. Subscribe by role
  2. Individual subscriber lists

As for a different styling by section, you can take a copy of the default XSL files provided by the module, tweak them, and then submit the new XSL files view the. If you access the documentation via the Advanced help module, the topic name is "Advanced: Newsletter formats"

arski’s picture

Hey there,

I must say I'm loving this module compared to the unoverviewable simplenews mess (they should rename it to something that doesn't have 'simple' in the name).

Anyway, I would also really love to have some kind of simple way of subscribing a role to a newsletter. My scenario is that I want a newsletter sent out to all users that have a certain role regardless if they individually subscribed for it or not. In terms of unsubscribing, I'm happy to have a special role like "mail recipient" and I can make a small button that removes that role from the use if he wishes to unsubscribe. Basically, I would be happy with any implementation of this that allows sending newsletters to all users with a particular role :)

Thanks a lot in advance and let me know if I can explain/help more.

Cheers,
Martin

Mike Wacker’s picture

StatusFileSize
new174.83 KB

Here's what the UI for role-subscribe currently looks like.

arski’s picture

Hey there,

Looks great!

Can't wait to have the code in the -dev :)

Cheers,
Martin

Mike Wacker’s picture

Title: Rolesubscribe and list of subscribers » Subscribe by user roles
Status: Active » Needs review

The code is in the dev branch, so it should be available when the packaging script runs within the next 8 hours. I'm still in the process of testing it, though, and updating the automated tests.

I've moved the subscriber list into a separate issue #761450: Subscriber list. I will likely punt that request to the next release.

arski’s picture

Version: 6.x-1.3 » 6.x-1.x-dev

Hey, good work!

A couple of small bugs though:

1. If I go to the subscribe by role UI and select the sections for a role, only the "All sections" remains ticked, if I have some other sections then those remain unticked. In the database, the particular section seems to be saved, so maybe this was intended, but it's slightly confusing to see the particular sections unticked.. Also, the message saying that the user would have to remove the role to unsubscribe etc. appears twice (maybe more times for more sections).

2. The second one is much more important. When generating a list of subscriptions, the users that should be subscribed by role never get returned as they dont have a format defined for them. So when sunmailer_get_subscriptions goes through the parted noted as "// Retrieve users' formats and email addresses." it returns nothing for them. Maybe it would be a good thing to have a default format for a role or (much more easier I guess) for the newsletter in general. Note that if a user doesn't have a format defined the query wont return anything, so it won't return his email address either.

Other than this, it's all great :) Thanks so much for the fixes!

Cheers,
Martin

Mike Wacker’s picture

1. Could you clarify a bit? I added the "All sections" checkbox so you wouldn't have to check every box to do that. If it is checked, then the form submission logic ignores the remaining checkboxes and subscribe the role to all sections. As for the warning appearing twice, if only happens when you submit the form, and it has to do with some weird quick in the Form API that I can't control.

2. Subscribers do need to be added to some format - be it text or HTML. The code is designed to pick the default one for new subscribers that get added when a role is subscribed (likewise, the format is set to 0 - Not subscribed when unsubscribing a role unsubscribes users).

arski’s picture

Hey Mike,

Thanks for the answers.

1. I agree that it works, the only thing that was perhaps slightly confusing to me was that when "All sections" is selected, all the single sections are not ticked. Intuitively I would have expected them all to be ticked when opening the form for a selected role & when "all sections" has previously been enabled for that role. You know, because basically when you see that 'all sections' are enabled for this role you would expect every section to actually be ticked and not have an empty box. But this is just my view on the user interface, since it works I'm not really insisting on any changes.

2. Hmm, what do you mean by "a role is subscribed"? I just tested out two scenarios that are kind of normal and neither of them worked:
2.a. When I enable the newsletter for a particular role, the users who previously had that role don't get a format set automatically and are never returned.
2.b. Even if I enable the newsletter-role for a previously existing user who didn't have that role before, he still has no format set.

I find that since subscribing by role is something always done by the admin, this process should automatically do something that "subscribes" every existing user that has that role.

Please let me know if I'm missing something or if you have any further questions.

Thanks so much for your effort.

Martin

Mike Wacker’s picture

I think I know what's happening on 2. I didn't consider the scenario where the default format is not subscribed. I recently checked in some code to fix that.

arski’s picture

Hey, I looked into the code and that's not the problem really I think. What's seemingly wrong is that the users of a role are never actually inserted into the sunmailer_user_format or such when a role is subscribed.. so basically the role is subscribed, but since the _get_subscriptions method only fetches users that are in the sunmailer_user_format table, no user of that subscribed role is ever returned.

Something is definitely missing there.

Thanks for fixing.

Mike Wacker’s picture

Oh, I know what's going on now. Unsubscribed users can either have a 0 entry in the sunmailer_user_format table, or they have no entry. I was doing an update query, which only caught the former case. I will go ahead and fix that.

Mike Wacker’s picture

Status: Needs review » Fixed

The code has been finished and tested. Should any issues pop up, open up a bug report in a new issue.

arski’s picture

Yep, it works now. Thanks so much.

xkater’s picture

sub

Status: Fixed » Closed (fixed)

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