Loading src/Form/UserSettings.php +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** * Defines a form that configures forms module settings. * Defines a form that configures one user's settings. */ class UserSettings extends ConfigFormBase { Loading src/Form/UsersForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** * Defines a form that configures forms module settings. * Defines a form that configures settings for all subscribed users. */ class UsersForm extends ConfigFormBase { Loading src/Notify.php +30 −8 Original line number Diff line number Diff line Loading @@ -121,6 +121,35 @@ class Notify implements NotifyInterface { ->execute(); } $def_nodetypes = $this->config->get('notify_nodetypes'); // Loop over node types. foreach ($def_nodetypes as $nodetype) { $key = static::NODE_TYPE . $nodetype; $subscribe = $values[$key]; $id = $this->database->select('notify_subscriptions', 'n') ->fields('n', ['id', 'uid', 'type']) ->condition('uid', $uid) ->condition('type', $nodetype) ->execute()->fetchObject(); if ($id) { if (!$subscribe) { $sid = $id->id; $this->database->delete('notify_subscriptions') ->condition('id', $sid) ->execute(); } } elseif ($subscribe) { $this->database->insert('notify_subscriptions') ->fields([ 'uid' => $uid, 'type' => $nodetype, ]) ->execute(); } } } /** Loading Loading @@ -321,7 +350,6 @@ class Notify implements NotifyInterface { // ->condition(((new Condition('AND'))->condition(true) // (AND () (OR (AND ()()) (AND ()()))) if ($this->config->get('notify_include_updates')) { // dpm('incl. updates', 'comms'); // Only comments attached to nodes are called 'comment'. $q->condition((new Condition('AND')) ->condition('c.comment_type', 'comment', '=') Loading @@ -337,7 +365,6 @@ class Notify implements NotifyInterface { $res_comms = $q->execute()->fetchAllAssoc('cid'); } else { // dpm('no updates', 'comms');. $q->condition('c.comment_type', 'comment', '='); $q->condition('v.created', $since, '>'); $q->condition('v.created', $send_start, '<='); Loading @@ -346,7 +373,6 @@ class Notify implements NotifyInterface { $res_comms = $q->execute()->fetchAllAssoc('cid'); } // Foreach ($res_comms as $row) { // dpm($row, 'comms'); // } // Get published comments in unpublished queue. $q = $this->database->select('notify_unpublished_queue', 'q'); Loading @@ -358,7 +384,6 @@ class Notify implements NotifyInterface { $q->allowRowCount = TRUE; $res_copub = $q->execute()->fetchAllAssoc('cid'); // Foreach ($res_copub as $row) { // dpm($row, 'copub'); // } // Get unpublished comments in unpublished queue. $q = $this->database->select('notify_unpublished_queue', 'q'); Loading @@ -370,7 +395,6 @@ class Notify implements NotifyInterface { $q->allowRowCount = TRUE; $res_counp = $q->execute()->fetchAllAssoc('cid'); // Foreach ($res_counp as $row) { // dpm($row, 'counp'); // }. } else { Loading Loading @@ -631,8 +655,7 @@ class Notify implements NotifyInterface { ], ['langcode' => $upl]) . "<br />" . '</p>' . $node_body; } } //dpm($field, 'field before comments'); // Need to filter on content type and pernission, see issue #3221814. // Need to filter on content type and pernission, see issues #3225558 and #3221814. // Consider new comments if user has permissions and comments are ready. if ($userrow['comment'] && $userobj->hasPermission('access comments') && count($comments)) { $comment_count = 0; Loading Loading @@ -684,7 +707,6 @@ class Notify implements NotifyInterface { */ // Creates a link do be embedded in HTML mail (needs work): //$htmllink = Link::fromTextAndUrl(t('Read more'), Url::fromUri('internal:/comment/' . $cid, ))))->toString(); //dpm($htmllink, 'htmllink'); // Creates a link to be embedded in plain text mail: $commentlink = $host . $permalink; $commentlinks[$commentindex]['title'] = $node->label(); Loading Loading
src/Form/UserSettings.php +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** * Defines a form that configures forms module settings. * Defines a form that configures one user's settings. */ class UserSettings extends ConfigFormBase { Loading
src/Form/UsersForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** * Defines a form that configures forms module settings. * Defines a form that configures settings for all subscribed users. */ class UsersForm extends ConfigFormBase { Loading
src/Notify.php +30 −8 Original line number Diff line number Diff line Loading @@ -121,6 +121,35 @@ class Notify implements NotifyInterface { ->execute(); } $def_nodetypes = $this->config->get('notify_nodetypes'); // Loop over node types. foreach ($def_nodetypes as $nodetype) { $key = static::NODE_TYPE . $nodetype; $subscribe = $values[$key]; $id = $this->database->select('notify_subscriptions', 'n') ->fields('n', ['id', 'uid', 'type']) ->condition('uid', $uid) ->condition('type', $nodetype) ->execute()->fetchObject(); if ($id) { if (!$subscribe) { $sid = $id->id; $this->database->delete('notify_subscriptions') ->condition('id', $sid) ->execute(); } } elseif ($subscribe) { $this->database->insert('notify_subscriptions') ->fields([ 'uid' => $uid, 'type' => $nodetype, ]) ->execute(); } } } /** Loading Loading @@ -321,7 +350,6 @@ class Notify implements NotifyInterface { // ->condition(((new Condition('AND'))->condition(true) // (AND () (OR (AND ()()) (AND ()()))) if ($this->config->get('notify_include_updates')) { // dpm('incl. updates', 'comms'); // Only comments attached to nodes are called 'comment'. $q->condition((new Condition('AND')) ->condition('c.comment_type', 'comment', '=') Loading @@ -337,7 +365,6 @@ class Notify implements NotifyInterface { $res_comms = $q->execute()->fetchAllAssoc('cid'); } else { // dpm('no updates', 'comms');. $q->condition('c.comment_type', 'comment', '='); $q->condition('v.created', $since, '>'); $q->condition('v.created', $send_start, '<='); Loading @@ -346,7 +373,6 @@ class Notify implements NotifyInterface { $res_comms = $q->execute()->fetchAllAssoc('cid'); } // Foreach ($res_comms as $row) { // dpm($row, 'comms'); // } // Get published comments in unpublished queue. $q = $this->database->select('notify_unpublished_queue', 'q'); Loading @@ -358,7 +384,6 @@ class Notify implements NotifyInterface { $q->allowRowCount = TRUE; $res_copub = $q->execute()->fetchAllAssoc('cid'); // Foreach ($res_copub as $row) { // dpm($row, 'copub'); // } // Get unpublished comments in unpublished queue. $q = $this->database->select('notify_unpublished_queue', 'q'); Loading @@ -370,7 +395,6 @@ class Notify implements NotifyInterface { $q->allowRowCount = TRUE; $res_counp = $q->execute()->fetchAllAssoc('cid'); // Foreach ($res_counp as $row) { // dpm($row, 'counp'); // }. } else { Loading Loading @@ -631,8 +655,7 @@ class Notify implements NotifyInterface { ], ['langcode' => $upl]) . "<br />" . '</p>' . $node_body; } } //dpm($field, 'field before comments'); // Need to filter on content type and pernission, see issue #3221814. // Need to filter on content type and pernission, see issues #3225558 and #3221814. // Consider new comments if user has permissions and comments are ready. if ($userrow['comment'] && $userobj->hasPermission('access comments') && count($comments)) { $comment_count = 0; Loading Loading @@ -684,7 +707,6 @@ class Notify implements NotifyInterface { */ // Creates a link do be embedded in HTML mail (needs work): //$htmllink = Link::fromTextAndUrl(t('Read more'), Url::fromUri('internal:/comment/' . $cid, ))))->toString(); //dpm($htmllink, 'htmllink'); // Creates a link to be embedded in plain text mail: $commentlink = $host . $permalink; $commentlinks[$commentindex]['title'] = $node->label(); Loading