Closed (fixed)
Project:
Subscriptions
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2007 at 05:11 UTC
Updated:
1 Dec 2007 at 00:57 UTC
There seem to be many, many, many problems while dealing with subscriptions via node form. I did make sure everything is set up right (the module, the permissions, the global autosub setting, the user's autosub setting, sub to own posts). The problems:
1) When posting a new node, "Subscribe" box is NOT checked even though it must be according to autosub settings
2) Even if I check it manually (for new node), once posted the node is not subscribed
3) When editing existing node I can neither set nor unset the subscription setting
Subscriptions/ unsubscriptions work fine for me when using the links... There are clearly major bugs in node forms...
Comments
Comment #1
dkruglyak commentedOK, I jumped the gun on declaring this as "MAJOR bugs". Looks like the problem behavior was caused by "subscribe to own posts" not originally checked, but with the check it does work - for creating NEW nodes only.
However it is still not possible to subscribe / unsubscribe to a post by checking / unchecking "Subscribe" on the node form. Looks like there is a bug in subscriptions_nodeapi, whereas case 'update' does nothing. No it does not go to execute the case 'insert' as the comment in the code implies (// else, fall through). Since $op is 'insert' it cannot execute 'update' code chunk.
The code from 'insert' case (which I presume does the actual processing) needs to be moved to a separate helper function that would be called by both 'insert' and 'update' cases. Sorry, do not know how to roll a patch.
Comment #2
coltraneIt is kind of a bug, though it may be a design decision gone wrong.
In subscriptions_form_alter() subscriptions_currentstatus is set to the value of the node's status. The update case of subscriptions_nodeapi() checks if $node->subscriptions_currentstatus is 1 and if so then it does not fall into the insert case.
The problem is that if you are updating a node to subscribe to it you want the insert case to happen so it'll add you to the subscribe table.
dkruglyak, if you want a somewhat fix to this problem you could comment out line 690 of the module in the _nodeapi() function:
and replace it with just a check on the node's status:
This replacement will mean that whenever there is any update to the node the insert case will be called. There may be cases when you do not want this to be called, but that is what is wrong with the design here and should be addressed more in detail.
I'm not convinced that you would want to put the code from the insert case into the update case. The 'fall through' should work, it's not just because of $node->subscriptions_currentstatus.
dkruglyak, when you say you set the user's autosub option you mean that you have enabled autosubscribe in their user profile, yes? When that user is making a post do you have a subscription option during node creation and also edit?
On the most recent cvs release if I have a user's autosubscribe option enabled they do not have an option to unsubscribe to individual posts, it's all or nothing, so I'm curious how you have done this. This is part of the code actually in subscriptions_form_alter().
btw, I've changed the status of this issue as a patch hasn't been rolled and I think it needs further attention.
Comment #3
liquidcms commentednot sure if this is under same category or not but i am new to trying subscriptions and a couple things strike me as odd:
- if i edit a node created prior to enabling subscriptions module there is no subscriptions option (which i think sounds like what you are talkng about here)
- there is also no link to subscribe for nodes which were created before i enabled the module
so maybe i am missnig the point here for the UI... and i will look through the code (and likely fix it) if this wasn't the intent.. but..
- should this module not simply do a nodeapi and insert "sub link" on ALL nodes that match the type selected??
in which case doesnt matter when they were created... you arent actually storing something in the database as part of the node itself are you??? that would be silly
- why is there any setting in the form to edit/add a new node ???
---- the subscribe isnt for the author it is for visitors
---- or i guess this is simply to override the admin settnigs for auto-sub to your own content
Comment #4
dkruglyak commentedThe logic still appears to be broken in 5.1. Marking for further review.
Comment #5
salvissubscribing
Comment #6
bdragon commented5.x-2.0 version is a complete rewrite, any bugs in it are new, all prior versions becoming unsupported, closing for that reason. Please help test the 5.x-2.0 betas. Thanks.