Hey,
is there any documentation on how to programatically subscribe a user to a content type subscription? I'm trying to find documentation on the Notifications API, but it seems sparse.
what I'm trying to accomplish is:
- user registers for an account
- new users automatically is subscribed to content type of "forum"
which functions should I be looking at? how do I build the subscription object? Any help appreciated! Thanks.
Comments
Comment #1
zeezhao commentedIn D6, used notifications_save_subscription(). Not sure if its the same in D7.
See these old links for some ideas on usage:
http://drupal.org/node/805742
http://drupal.org/node/791204
http://drupal.org/node/954754
Comment #2
webflo commentedHere is a Drupal 7 example.
Take a look at Notifications Rules.
http://drupal.org/project/notifications_rules
#1241652: Port Notifications Rules to Drupal 7
My Sandbox: http://drupal.org/sandbox/webflo/1241646
Comment #3
webflo commentedEven more examples #1346080: Error trying to set up node-type auto-subscriptions using hook_user_insert()
Comment #4
agerard commentedif I did this:
but wanted to set_user([new account]) - not 'acting user', which could be admin - is that available to me here?
Thanks again!
Comment #5
agerard commentedAnyone?? Still trying to figure out how to auto-add subscription for new users when they are added by admin (since the code above just results in duplicate subs for admin). Apparently this is an issue in 6 as well, where the module supports much more 'out of the box' [see "1) Option for new users to be subscribed by default; 2) Batch add subscriptions for multiple users (per username or role)"]. The module is great and I appreciate the efforts of all contributors, hope to someday have enough knowledge to give something back but right now I'm running as fast as I can just to keep up...I could really use some (more) clues on this question. Thanks!