User Notification Options Per Node
I have organic groups with event and discussion node types. The user should be able to opt in/out for mobile notifications per each discussion. So, if a user doesn't want to be notified of replies for a specific discussion, they should be able to turn off notifications for that discussion. I'm using rules and push_notifications already but trying to add this feature to my app.
I'm curious if anyone has ventured down this path because I'm not sure the best route to take. Here's some of my current thoughts and am looking for feedback on what might be the best option in terms of simplicity, efficiency, and security that will work with Drupal and DrupalGap.
- Create a User Field
- This would probably be better for security since only the specific user has access to their fields
- Create a Node Field
- I think the only way to make this work is to make the field editable by all users, which probably isn't very good security wise.
- Create a Custom Table Schema outside Drupal/DrupalGap
For (1) and (2), the sub options are:
-
Create one field and store node IDs that user has opted NOT to receive notifications as a comma separate list (1,23,456,7890) stored in the field. Then when determining if the user has opted in or out of notification, can just iterate through the list. This would be best storage wise, but will add complexity (I think) to the custom SQL queries for notifications in my rules.
-
Create an unlimited field and store each each node ID separately. I don't think DrupalGap supports unlimited values yet.
My current thought is to create one user field in which ALL nodes the user has opted OUT of for notifications are stored in a comma separate string. Opting out is probably also better than opting in because there probably won't be many 'opt outs' but want users to have the option if they want.
I implemented (1) Create a user Field and the the first bullet (creating one field). Here's an example of what I did that has been working great: