Active
Project:
Notifications
Version:
6.x-2.3
Component:
Notifications
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Nov 2010 at 05:44 UTC
Updated:
29 Jan 2012 at 22:13 UTC
I'm using the revisioning module to allow a pending revision of current nodes to be created, edited and reviewed prior to it replacing the current published revision. When a user subscribes to a node, they are getting notifications on every edit to the pending revision, even though they have no access to see this revision.
Is there a way to restrict notifications to only updates that are published?
Comments
Comment #1
danchadwick commentedThis implies that if you have selected notifications upon creation but not update, that the notification not be send when an unpublished node is created and that it is published when the unpublished node published (i.e. status 0 -> 1).
I need this too.
Comment #2
jzornig commentedI thought it did this. The module does test the $node->status. In my case the node is already published, but the updates are being made to a pending revision. I have made a change to the notifications_content_nodeapi() function in sites/all/modules/notifications/notifications_content/notifications_content.module which has achieved what I was after, but I used the values of my workflow state cck field to achieve this. So my modification is unlikely to be of use to you as is. I've put it below just in case it helps you find your own solution.
Comment #3
TheDanScott commentedHi All,
I'd like to re-kindle this issue if possible. I'm having this issue with the current latest versions of notification and revisioning. I've made a note of this issue (along with some other quirks when these two modules are mixed) over on the revisioning project at http://drupal.org/node/1415558
With my (sometimes naive) view of Drupal, I would hope that this is something that could be sorted out using the information that core Drupal and the Revisioning module make available.
I stuck a dpm($node) in the notifications_content_nodeapi() function and saved a new (pending) revision. Here is the output that came back:
The good news is that the vid value accurately reflects the (new, pending) revision that was just saved. So the question simply becomes how to check if that revision is "published". Does core Drupal offer anything that can determine that for a revision? (it seems the node->status and node->is_pending both reflect the overall node, which already has a published revision).
Does anyone have a suggestion on how this might be done in a way that is "revisions module agnostic" (since revisions is just modifying core functionality in drupal). The Node Tools module (a dependency of revisions) has a simple little function to get the "current revision" as follows:
Would it be worth checking the revision of the node passed into nodeapi against drupal's understanding of the "current" revision (using the query above) and if they don't match then cancel the "notification"? Would such a check break any other behaviour?
If Core Drupal can't offer anything, then I guess I should be chasing up the revisioning team to ask what the best way to check a revision's status is (as I assume their module will provide some sort of API for that)?
Comment #4
rdeboer@TheSchmuck:
The reason why you are not seeing any of the additional revision info from the Revisioning module is because 'revisioning' comes after 'notifications_content' in the alphabet. Therefore
notifications_content_nodeapi()is called prior torevisioning_nodeapi().We could change this by decreasing the so-called "weight" of Revisioning. However this may have side effects on existing installs of Revisioning.
A better approach may be to call in your own hook code the function
node_load($node->nid, $node->vid). This will load the correct revision (which is cached anyway) and will also invokerevisioning_nodeapi(), which will flesh out goodies like $node->is_pending etc. Try anotherdpm($node)to see what's in there.Rik