When you create a node with subscription module activated, will always display the checkbox : "Receive notification of replies..." by the end of node form.

The problem is that subscriptions_nodeapi doesn't check if comment are allowed for this node. Just add $node->comment == 2 to correct this.

This gives you :

    case 'form post':
      if (!$user->subscriptions_auto && $node->comment == 2) {
        $allsubs = subscriptions_get_user();
        $val = isset($node->subscriptions_subscribe) ? $node->subscriptions_subscribe : $allsubs['node'][$node->nid] ? 1 : $user->subscriptions_subscribe;
        return form_item(t('Subscribe'), form_checkbox(t('Receive notification of replies to this %name.', array('%name' => node_invoke($node, 'node_name'))), 'subscriptions_subscribe', 1, $val));
      }

Comments

erikhopp’s picture

Priority: Minor » Normal

i have tried this, and the subscription checkbox still shows up for me when i am an anon user.

instead i tried adding " && $user" to check if there was a user id, but that didn't work either.

erik

tostinni’s picture

You don't adress the right variable. You need to check $user->uid because $user will always exists even if it's an anon user.
So here is the new patch :

    case 'form post':
      if (!$user->subscriptions_auto && $node->comment == 2 && $user->uid) {
        $allsubs = subscriptions_get_user();
        $val = isset($node->subscriptions_subscribe) ? $node->subscriptions_subscribe : $allsubs['node'][$node->nid] ? 1 : $user->subscriptions_subscribe;
        return form_item(t('Subscribe'), form_checkbox(t('Receive notification of replies to this %name.', array('%name' => node_invoke($node, 'node_name'))), 'subscriptions_subscribe', 1, $val));
      }

Good luck

dziemecki’s picture

Assigned: Unassigned » dziemecki

I'll give this a test and commit if it works.

dziemecki’s picture

Status: Active » Closed (fixed)

This fix has been committed.