Download & Extend

Only one tid in notifications_fields 'value' field

Project:Notifications Add-ons
Version:6.x-2.x-dev
Component:Custom subscriptions
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

I can't for the life of me figure what I'm doing wrong. I'm creating a custom subscription type with two taxonomy terms. When I subscribe a user to this custom type, I see that the notifications table and notifications_fields table are being updated, but only one tid is being entered into the notifications_fields table in the value field. I was presuming, based on this comment - http://drupal.org/node/521974#comment-2135214 - that all tids associated with the custom subscription type would display in some form in the value field.

Testing confirmed also that the subscription type isn't working properly, insofar as it is really only subscribing to the one tid that is displaying.

I have updated to the most recent version of Notifications and the dev version of Notifications Add-Ons to try to resolve this issue, but still running into the same problem.

Thanks for your help.

Comments

#1

Some additional info that will hopefully add to and clarify my issue:

I installed this multitag module - http://drupal.org/node/328708 - in an attempt to see how it worked and if it would be a solution for my needs. Apparently, it attempts to add multiple taxonomy terms as conditions to a subscription by uniquely identifying the field names (tid, tid2, tid3, etc...), but in testing this does not appear to be working to me.

Also looked at the data model - http://drupal.org/node/312427 - but there is no example of adding more than one taxonomy term as a condition.

So, this has me questioning if creating a custom subscription with more than one taxonomy term is even possible. When adding a taxonomy term as a condition to a subscription type, is 'tid' the required field name?

#2

Category:support request» feature request
Status:active» needs review

I have encountered the same problem and investigated the issue. The attached patches are working for me.

The schema in the notifications module for the notifications_fields specifies PRIMARY KEY (sid, field) so any attempt to add another term will result in a duplicate primary key. The attached patch notifications_multiple_tids.patch sets the PRIMARY KEY to (sid, field, value). This led to a MySQL error due to the primary key length. This patch also reduces the length of the field and value columns. Note, this patch is to be applied to the notifications module, not notifications_extra. Also, an update function will be necessary, but is not included.

The attached patch notifications_extra_multiple_tids.patch includes a small change that allows multiple fields with the same field name (tid in this case).

There are some field types that don't make sense to allow multiple values (content type, author for example). It would make sense to have validation on the Custom subcriptions form.

AttachmentSize
notifications_multiple_tids.patch 1.23 KB
notifications_extra_multiple_tids.patch 698 bytes

#3

I added the update function to this patch. You should be able to apply these patches and run update.php and test this change.

The notifications_extra patch is the same as #2, but I included it to avoid confusion.

AttachmentSize
notifications_multiple_tids.patch 1.98 KB
notifications_extra_multiple_tids.patch 698 bytes

#4

Thanks kswan.

I actually worked around my problem with the use of a Rule and session variables to create a multi-part taxonomy term. It's convoluted, but it works for me :)

Still, surely many will appreciate your patches and find them useful.