An outline of how School of Everything uses taxonomy and notifications to keep users up to date with what is happening on the site. Our modules have now been released as dev versions, and we thought we would share how they work.
School of Everything wants people to be interested in stuff. Tell the School what you want to know more about, and we will keep you informed about other people into the same things. We wanted to find the right way to allow our users to manage their “interests”, and to receive regular, tailored email updates about relevant activity on the site. To build this, we ended up creating some new tools for managing taxonomy on node profiles, and a new plug-in for the notifications framework.
I will tell you some of the story of how we have gone about implementing our plan. This has been something I have wanted for almost every site I have built, and so hope that others may find our work helpful. The screenshots here will show output that has been themed to our requirements, but they are not too far off from what you get “out of the box”. At the time of writing, our code is available at version one release, and will be fine for use on a live site, but there is still much on the todo list, so, you may need to muck in a little if you want to do this yourself.
The first part of this document will cover the Taxman, our Taxonomy Manager, and how we use it to provide a clean interface for updating lists of terms. The second section covers our notifications implementation.
The Taxman
Taxonomy is one of the things that makes Drupal special. The lack of a site hierarchy is often confusing to new users, but eventually taxonomy digs in, and that old site tree fades away. Taxonomy management however is not always all that user-friendly, and we found that we needed to do a little work on the interface.
The idea withSchool of Everything is that users maintain a list of things they want to learn, and we help them find people who can share their knowledge. We have used nodeprofiles to give each user a “learner profile”, and allow users to tag this profile with subjects they want to know more about. ( You can take a look at my profile for an example.)
Subjects are managed as freetagging taxonomy vocabulary. For many of us, managing a comma separated list of values is pretty straightforward, but unfortunately, we found that it confused many of our users. We also wanted to integrate display and edit of subjects to make it easy for users to keep the list updated. What's more, freetagging taxonomy edit boxes only allow you to keep track of a limited number of subjects, and can cause some confusion when their content gets cut short. One of the functions of The Taxman is to provide a simple way of managing large lists of freetags.
Taxonomy Edit Block
The Taxman, (short for Taxonomy Manager, but also the name of a pre-existing module) implements a themable display and edit block for taxonomy. When a user has update rights on a node, they are presented with options to add and remove tags. Users unable to make edits just get the list of subjects. These screenshots show how we have implemented this on School of Everything, they also show, on the non-edit view, another Taxman feature – the profile tagger.
Node Profile Tagger
We wanted to make it easy for users to add new interests to their profiles. As people browse the site, the idea is that they can say, “I am interested in this, add it to my profile”. The Taxman's second use, the Node Profile Tagger provides a block that can appear on taxonomy pages, presenting the user with a toggle link that will let them add and remove the current term from their interests.
The tagger integrates with nodeprofile, and even supports multiple profile types. On School of Everything, we have profiles for teaching and learning, and so people can say they “want to learn this” or “can teach this”. If users don't yet have a profile, they will be prompted to create one. The second Taxman screenshot shows our block, which can be plugged into any taxonomy context.
The Taxonomy API and REST interface
In order to achieve our plans for a simple taxonomy management interface, we ended up creating a helper module to facilitate our lower level taxonomy activities. The taxonomy_api module takes some of the code from Taxonomy, and breaks it down into a slightly more modular format. The taxonomy_rest module provides a way of managing node taxomony with urls. Instead of posting a form to add or remove terms from a node, we can just create a link that can be embedded in any html. A provided theme function makes sure that these links are secure.
Notifications
In almost every Drupal site I have ever built, I have felt the need to have a good way to keep users informed about what was going on. Newsletters are not customised, RSS feeds need someone to actually pay attention and individual email updates just spam people. Most of the time, I just gave up, but then, along came Notifications.
Through the notifications module users can receive regular (or instant) updates about new or updated content, tailored to their specific interests. Multiple updates are grouped together so that there is no email storm, and the actual method of delivery (email, private message, or even sms) can all be managed by the user (if you want them to have that kind of power).
The Framework
The Notifications framework provides a general system for creating aggregated updates on events that happen across the site. The actual Notifications module itself does not actually do anything more than provide the mechanism, with all end-user functionality implemented in plug-in modules. The package contains modules that update users on node changes, filtered by type, author or term, and also integrates with organic groups and feeds.
Notifications uses the messaging module, another framework, to handle the actual sending of messages. This allows the delivery method to be managed separately to the content creation.
We produced a visual guide to the notifiactions framework, you should be able to find it here: http://drupal.org/node/284657.
Node Taxonomy Notifications
School of Everything maintains user interests as taxonomy on profile nodes. If we were to use the standard taxonomy notifications system, we would end up duplicating data, storing notification information in the standard notifications tables, and again on our profile. To avoid this, potentially nasty, situation we created a module to base subscription information on a specific node's taxonomy.
In practice this module allows users to subscribe to a node. When determining which users to inform about a node update, we look at the taxonomy terms on our subscribed node, if there is a term in common with the updated node, we trigger a notification.
Since we designed this system to work with profiles, we also set things up so that some node types can be designated at automatic, and so, when a user creates a profile node, they immediately get subscribed.
Notifications management blocks
The nodetaxonomy_notifications module also provides a few blocks to create neat interfaces for users to manage their notifications settings. We used some of the tools we had built for REST based taxonomy updates, and provided the same tools for notifications. Update frequency and format can be easily managed though themeable urls, rather than hard to manage forms.
The Eventual Result
School of Everything sends out daily, weekly or monthly updates. The format of these updates is managed by the individual notifications modules and the messaging module. Actual copy can be customised with tokens and localisation. Here is an example of the email I got from School of Everything the other day:
Hello Peter,
Here's what's new for you on School of Everything:
* Margherita Dal Pra, yoga teacher, updated their teacher page: http://www.schoolofeverything.com/teacher/margheritadalpra
* Krista Hedley, yoga teacher, updated their teacher page: http://www.schoolofeverything.com/teacher/kristahedley
* Nick Herman, Maths and Science student who also teaches, updated their teacher page: http://www.schoolofeverything.com/teacher/nickherman
* Caroline Shola Arewa, Personal Development & Energy Medicine trainer, updated their teacher page: http://www.schoolofeverything.com/teacher/carolinesholaarewa
* Trisha Hills, yoga teacher, updated their teacher page: http://www.schoolofeverything.com/teacher/trishahills
* Michael Cragg, Pilates and Personal Training teacher, updated their teacher page: http://www.schoolofeverything.com/teacher/michaelcragg
--
We're telling you this because you've told us you want to learn Astrology, open source, tarot, team programming methodologies, yoga and yoga for self practice. To edit your subject list or manage these e-mail updates, visit your School of Everything profile at http://www.schoolofeverything.com/user/greenman.
Best wishes,
Team Everything
http://www.schoolofeverything.com
Much more
These things always sound so simple when you have finished them. This whole process took us a good while to get right, and the chances are, we got some things wrong. That however, is what makes open source so valuable - we can ask for help!
We have produced some more documentation on notifications, in the hope that we can get more people making use of this great framework. At the moment, School of Everything is built on Drupal 5, and so we are not really able to build versions for 6. There are all sorts of ways that this project could move forward and we would love to find some collaborators.
The Details
Notifications module: http://www.drupal.org/project/notifications
Messaging module: http://www.drupal.org/project/messaging
Taxonomy API and REST interface: http://www.drupal.org/project/taxonomy_api
Taxman: http://www.drupal.org/project/taxman
Node taxonomy notifications: http://www.drupal.org/project/nodetaxonomy_notifications
Sign up at School of Everything, plug in a few interests, and see what you get out.
Comments
Modifications
Duh! Unfortunately I don't have rights to fix some of the errors in my content. I would like to go back and clean a few things, but it should work well enough for now.
.
Leave the updated post in a comment and I'll replace the original for you.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Awesome idea for a site and
Awesome idea for a site and I love the site itself; I'm very jealous that I don't have the ability to make drupal do all that fantastic stuff. One of these days I *am* going to start to learn php!
Best of luck with the venture.
Good write up
God write up, excellent insight.
I believe this post is worthy of front page promotion. Thank you for contributing the modules. You already know this, but great website and team behind it too ;)
---
Dee
iScene Interactive :: iScene.eu
A visual overview of the notifications system
As part of this project, we also produced this visual overview of the notifications module. It might be useful.
http://drupal.org/files/images/notifications_overview-web_export.png
This module is brilliant, so
This module is brilliant, so close to what I need. Has anyone been able to modify this so that it sends notifications for nodes that have ALL terms that a user has subscribed to - rather than just any one of them?
e.g.
PUBLICATION TYPE: book, magazine
GENRE: fiction, art
If a user subscribes to "book" and "art" then they don't necessarily want all book notifications and all art notifications - just notifications for nodes that have both.
Thanks.
awesome. I'll be keeping an
awesome. I'll be keeping an eye on how this group of modules develops!
Very interesting. watching
Very interesting. watching too.
Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.
Taxonomy API: thank you!
Thanks for the taxonomy API - I needed it today to apply some changes in an existing site and I was surprised that there is not someting like
drupal_set_term($nid,$tid)already. I never like it when people start yelling "this module should be in core"... but here's a candidate if you ask me.