I needed to have all my eZine subscribers assigned to an unique role in order to take advantage of the ubercart discount module. I couldn't figure out how to do this without changing code (I think it could be done using actions and/or triggers in v6, but my site is still v5). Am I missing something and could have done this in v5 without writing code?

I had originally hacked the core simplenews module to accomplish this, but decided to try my hand at module development and extend the functionality the "right" way. I have attached my add-on module, which I describe as beta, but I am running on my production site (http://www.trizmpuzzle.com). Before I try and contribute it, I wanted to get some feedback from the community as to whether they think it is useful or not.

Andy

Comments

sutharsan’s picture

I did not look at the code yet, but please explain the difference with simplenews_roles and why you can not modify this module to get the job done. Btw I know simplenews_roles needs a new maintaner.

puzzlemaster’s picture

This essentially the reverse of simplenews_roles. Simplenews_roles takes a group of existing users that have a given role and then subscribes them to a newsletter. This module maintains a table that maps newsletters to roles, and when a user subscribes to the newsletter, it then associates them to the role(s) associated with that newsletter. It can also bulk add newsletter subscribers to a role. This fits my use case much better, as I think the user needs to choose whether or not to subscribe, and the maintenance of the roles stays transparent. Did this help?

Andy

sutharsan’s picture

I don't like to put any new functionality to the 5.x branch, 6.x and HEAD is where development takes place. This functionality has not been requested before and therefore I don't see a large audience for this in Simplenews.

sutharsan’s picture

Project: Simplenews » Simplenews Roles
Version: 5.x-1.5 » 5.x-1.x-dev

Perhpas you can to combine it with Simplenews Roles. But upgrade to 6.x (or 7.x) first.

joachim’s picture

So... what your code does is give everyone who voluntarily subscribed to newsletter A the role B? And this is so Ubercart discounts can see them and give them a discount?
I think from the Ubercart point of view it would be better to code a Conditional Actions condition that tests if a user is a subscriber, rather than go round the houses via role assignment.