Hi
I've been testing Notifications over the weekend with a view to replacing Notify.
An impressive piece of work but I ran into one major obstacle which prevents me implementing it at the moment and also seems to be an issue for some other people.
I want people to receive (or preferably have the option of receiving) the full content when they are notified so they don't have to log into the site (just as a reminder - Notify gives option of title or teaser or full content). But the content types are radically different eg they might be a story, a forum post or cck content that contains a library item. It seems I have to use the same format of message for each content type and that just doesn't work. If I use the tokens relating to library items for example, when I receive notifications relating to forum posts the tokens appear unresolved (they could at least be omitted altogether).
Possibly I missed some crucial piece of functionality which already exists and possibly the features I want can be coded up quite quickly by someone who knows what they are doing. Anyway, I seek advice/help. I am not technical at all ie no relevant coding skills but there is a guy who helps me with that stuff.
Thanks in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | screenshot4.png | 146.75 KB | jose reyero |
| #3 | notifications_token.zip | 2.84 KB | sagannotcarl |
Comments
Comment #1
moshe weitzman commentedOne idea is for Notifications is to impement a $node->build_mode and then implement CCK's Extensible Contexts hook so that admins can pick which fields are in and which are out for a given content type. Further, they can pick a formatter like 'teaser' versus 'full'.
Comment #2
moshe weitzman commentedComment #3
sagannotcarl commentedI had a similar problem and I solved it by making a new token that called a template file (as in phptemplate, not notifications template). That way in the phptemplate file I could do whatever logic or switching I needed to. I'm sure there is a better way to do it (moshe's sounds interesting), and pre-processing things in the template.php file would definitely be cleaner, but this might be useful to someone.
Basically it gives you a token called [themed-teaser] that you can put in your notifications templates and then do all the fancy stuff in php instead of dealing with tokens.
Just put print_r($node_object); in the template file and send yourself a test notification to see everything you've got available.
ps. I put my notifications.tpl.php in the same folder with my other templates, but if you want it with the module you should change the path in the module code.
Comment #4
sagannotcarl commentedAlso, there is a difference between choosing which fields are in the notification for each content type and having a real template. As you can see in my example, I'm doing some logic to determine language that you wouldn't be able to do with more/different tokens. For that flexibility, actually using the theme system makes a lot of sense to me.
Comment #5
jose reyero commentedWe are using this (experimental) module atm: Token Logic
Read about it here:
http://www.developmentseed.org/blog/2009/mar/25/tokenlogic-helps-messagi...
http://code.developmentseed.org/token_logic/dashboard
Comment #6
vstmusic commentedis this module (token logic) bug free ?
Thanks for your responses.
Comment #7
TripleEmcoder commentedI think this could be useful: http://drupal.org/project/contemplate. It's not perfect though, as you will not be able to make different templates for notifications and pages, and I think it requires you to write PHP code for the template, not use tokens.
Comment #8
vstmusic commentedUP !
Is it possible to use ONE notification template for each content type ? (contemplate is not useful for that)
Comment #9
jose reyero commentedWill be in this new branch
Comment #10
jose reyero commentedAn add-on module, alpha is in this Notifications Extra package, check out the 'Content Type extension' module.
(Needed some API extensions in the Notifications module though)
See the screenshot attached.
Comment #11
jose reyero commentedForgot to move to Notifications Add-ons
Comment #12
vstmusic commentedI have installed messaging and notifications modules 6.4.alpha1 and the Notifications extra module (6.4.developpement) and I have actived the Content Type extension BUT I don't see the options (compared to your screenshot in #10).
What is the problem ?
thanks !
Comment #13
vstmusic commentedWith alpha2, the option's configuration display in the administration section but it does not works. It's the "node creation" template that's send.
Comment #14
jose reyero commentedThis 'content type extension' has been moved into Notifications package and got some more releases. Open new issues there if any.
Comment #15
vstmusic commentedYes, and it seems really usefull !
THANKS !
Comment #16
jdln commentedHas anyone else had any issues with the token logic module?
http://code.developmentseed.org/token_logic/dashboard
Im getting this error;
Fatal error: Call to undefined function _token_replace_tokens() in /home/myserver/public_html/mysite/sites/all/modules/token_logic/token_logic.module on line 144
Thanks
Comment #17
jdln commentedIve been using sagannotcarl's module successfully for a while but ive just updated Notifications (which i hadn't done for a while) and now its stopped working. Lots of the fields are not coming through in the email.
Thanks
Comment #18
my-family commentedsubscribe
Comment #19
goldlilys commentedSubscribing, issue with token logic module, has that ever worked? That's the easiest way to make notifications logic but I get same error as #16
Will try out #3 method, is there a settings area for this or just enable and customize the notifications template?
Comment #20
hanoiiany chance this can be added to the 2.x branch, is it possible or just too much work? I don't mind rolling a patch for that, just wonder if it's at all possible?
Comment #21
hanoiiany chance this can be added to the 2.x branch, is it possible or just too much work? I don't mind rolling a patch for that, just wonder if it's at all possible?
Comment #22
laraz commented@sagannotcarl thanks. your solution works for me.