Drupal 6 Support
Jorrit - April 11, 2008 - 19:07
| Project: | Simplenews Roles |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
This module has to be converted to Drupal 6. I have attached my working version for this. Please check if this can be useful.
It has the added feature of removing footers for lists that are role-based. An unsubscribe link is pointless here.

#1
attachment is missing
#2
I'm sorry for that
#3
Thanks a lot to Jorrit!
Trying to activate, I get the message
"This version is incompatible with the 6.5 version of Drupal core"Any hints?
#4
You have to edit the info file as well, add something like core = 6.x. I don't know exactly anymore, look in other info files.
#5
Yes, I edited simplenews_roles.info. But not enough. With a reduction to
name = Simplenews Roles
description = "Automatically subscribe users in designated roles to a newsletter list."
package = Mail
project = "simplenews_roles"
core ="6.x"
#6
subscribing
#7
is this converted version working? possible to move to project page for more testing?
#8
subscribing
#9
subscribing
#10
subscribing
#11
+1
#12
subscribing
#13
I attempted to use your module. If I sign on as a user, go to the user's User Profile > My Newsletters, and attempt to unsubscribe from the newsletter, I get the following error messages:
* warning: array_keys() [function.array-keys]: The first argument should be an array in /htdocs/sites/all/modules/simplenews_roles/simplenews_roles.module on line 107.* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /htdocs/sites/all/modules/simplenews_roles/simplenews_roles.module on line 109.
* warning: array_unique() [function.array-unique]: The argument should be an array in /htdocs/sites/all/modules/simplenews_roles/simplenews_roles.module on line 109.
* warning: array_intersect() [function.array-intersect]: Argument #2 is not an array in /htdocs/sites/all/modules/simplenews_roles/simplenews_roles.module on line 112.
#14
subscribing
#15
subscribing
#16
Also subscribing
#17
Subscribe
#18
subscribe
#19
@#13, ron_s:
This error occurs because there is no checking whether the "$edit" array actually has a "roles" array which it might have gotten from the form being used.
I have had another problem with the "simplews_newsletter_footer" theme function. Appearantly there already is such a function in simplenews and simplenews_roles tries to re-register the function. I have simply renamed the function "simplenews_roles_newsletter_footer" which got rid of my problem. However I have not tested yet whether this theme function is absolutely necessary.
Also, I have added a call to "simplenews_unsubscribe_user" for those users that don't have a matching role id for the current subscription. I know that this might be redundant because a sync is made before a newsletter is sent. However, this makes sure that when you manually remove a role from a user the subscription for this user will be deleted.
I have done two identical patch files, the one expects the filename to be "simplenews_roles.module.txt" (like uploaded above) while the other expects it to be "simplenews_roles.module" (like it might be in an installed module)
I have not done extensive testing yet so please be sure to use this at your own risk!
Feedback would be appreciated! I also plan on adding an opt-out feature so that once you opted out you won't get subscribed again even if you do have the specific role(s).
#20
"Feedback would be appreciated! I also plan on adding an opt-out feature so that once you opted out you won't get subscribed again even if you do have the specific role(s)."
Right now, when a user opts out, what action will trigger his re-subscription? Ot the newsletter just gets sent to him anyway?
(Could you post an updated module with patches applied? Any ETA for the feature above mentioned? Thank you)
#21
Subscribing
#22
Changing status + subscribing.
#23
Works for me.
Here is the complete module from #2 with the patch from #19 and my changes:
static $role_newsletters;// let's cache this.
if(!isset($role_newsletters)) {
$role_newsletters = variable_get('simplenews_roles_tids_rids', array());
}
There is no point in caching a variable_get. All variables are already cached by Drupal core.
No idea what is going on in simplenews_roles_nodeapi:
// Strip out non-Simplenews terms from taxonomy for posterity.
Added some missing function doc headers and made a few code style cleanups too :)
#24
I've been given maintainership of this module, so I've gone ahead and committed the above (with a slight fix in my version of the info file -- I messed up the dependencies line!)
Thank you everybody for your hard work!
This should be available soon as a -dev version. Please test this further and report any bugs!
#25
BTW, @BSLFE: if you're still interested in working on an opt-out feature, see #331080: unsubscribe reverts back after cron run.
#26
@joachim - THANK YOU!
#27
Thanks :) Also thanks for all the people who took the effort to publish their patches.
#28
Automatically closed -- issue fixed for 2 weeks with no activity.