Hi

In mail settings there is:
You can stop receiving emails when someone replies to this post,
by going to [comment-subscribed:unsubscribe-url]

But in the mail when clicking on link this erreo appear:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxxx.comment_notify' doesn't exist: SELECT c.cid FROM {comment} c, ( SELECT oc.nid, oc.uid FROM {comment} AS oc, comment_notify AS ocn WHERE oc.cid = ocn.cid AND ocn.notify_hash = :hash ) AS o WHERE o.nid = c.nid AND o.uid = c.uid; Array ( [:hash] => wol5Iisa77yBCUOsxkHBp8FUR7-dtf4-_p9aE1xj-Ms ) i comment_notify_unsubscribe_by_hash() (linje 278 af /customers/c/f/e/xxxxx.xx/httpd.www/tmf/sites/all/modules/comment_notify/comment_notify.inc).

Pafla

CommentFileSizeAuthor
#9 1805568_table_prefix_on_delete.patch493 bytesgreggles
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

Was this a fresh install or an upgrade?

If you visit update.php are there updates to run?

Were there any errors when you enabled the module?

Are you using MySQL or Postgres?

That table should be created on every site - http://drupalcode.org/project/comment_notify.git/blob/refs/heads/7.x-1.x... so if it doesn't exist on your site then there could be a problem with install/upgrade or with the installation on your site.

Pafla’s picture

Hi

Fresh install of module and no errors on install

When i go to admin/modules/update
The "Comment Notify" is not in list

When i go admin/reports/updates and click "Check manually"
Then the "Comment Notify" module is green
However the installed v is 7.x-1.1+6-dev (2012-aug-15)
And recommended is 7.x-1.1 (2012-jun-13)

I´m using MySQL

Pafla

greggles’s picture

Can you try to disable the module, uninstall it, and re-enable it?

Pafla’s picture

Hi

I just found out that it does not send mail, but it has done earlier.

Maybe something wrong with my site or database.

I will try make a new clean install of drupal (my site).
When done i will then return.

Pafla

greggles’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

It's been more than 2 weeks and nobody else has this problem so closing this issue.

Please do reopen it if you can find the source of the problem.

Dr.Osd’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Status: Closed (cannot reproduce) » Needs review
Dr.Osd’s picture

Status: Needs review » Active

Hi. I have same problem with fresh install of comment notify 7.x-1.2.
In report I have errorr:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drozdu_mydomain.comment_notify' doesn't exist: SELECT c.cid FROM {comment} c, ( SELECT oc.nid, oc.uid FROM {comment} AS oc, comment_notify AS ocn WHERE oc.cid = ocn.cid AND ocn.notify_hash = :hash ) AS o WHERE o.nid = c.nid AND o.uid = c.uid; Array ( [:hash] => kwU3qGq4QkHrkfch853z5z_BNwZggBEJ_fEy5YU1ZF8 ) в функции comment_notify_unsubscribe_by_hash() (строка 278 в файле /hsphere/local/home/drozdu/mydomain.com/sites/all/modules/comment_notify/comment_notify.inc).

KitsuneSolar’s picture

Hi, too:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'prj_ololo.comment_notify' doesn't exist: SELECT c.cid FROM {comment} c, ( SELECT oc.nid, oc.uid FROM {comment} AS oc, comment_notify AS ocn WHERE oc.cid = ocn.cid AND ocn.notify_hash = :hash ) AS o WHERE o.nid = c.nid AND o.uid = c.uid; Array ( [:hash] => d57N0dmWv04ryhTVb7m85R6i6ObEk9cQrcZiUuDt0Mg ) в функции comment_notify_unsubscribe_by_hash() (строка 278 в файле /home/projects/prj_ololo/domain/public_html/sites/all/modules/comment_notify/comment_notify.inc).

PHP 5.4

It seems that there is no table prefix:
Table 'prj_ololo.comment_notify'

And I have a table with a prefix "main_", ie:
Table 'prj_ololo.main_comment_notify'

greggles’s picture

Title: PDOException: SQLSTATE... » PDOException: SQLSTATE... Base table or view not found when unsubscribing by hash
Status: Active » Needs review
FileSize
493 bytes

AHA - that's a great detail.

Can you try this patch?

KitsuneSolar’s picture

Excellent! It's working! And here there is no problem?

function comment_notify_unsubscribe_by_hash($hash) {
  $notification = db_select('comment_notify')
      ->fields('comment_notify')
      ->condition('notify_hash', $hash)
      ->execute()->fetchAll();

  // If this notification is at the node level, delete all notifications for this node.
  if (COMMENT_NOTIFY_NODE == $notification[0]->notify) {
    // Get all this user's comments for this node.
    $result = db_query("SELECT c.cid
      FROM {comment} c, (
        SELECT oc.nid, oc.uid
        FROM {comment} AS oc, {comment_notify} AS ocn
        WHERE oc.cid = ocn.cid
        AND ocn.notify_hash = :hash
      ) AS o
      WHERE o.nid = c.nid
      AND o.uid = c.uid", array(':hash' => $hash));

    $cids = $result->fetchCol();

    // Update all comment notifications to be disabled.
    return (bool)db_update('comment_notify')
      ->fields(array(
        'notify' => 0,
      ))
      ->condition('cid', $cids, 'IN')
      ->execute();
  }
  else {
   // Update this notification to be disabled.
   return (bool)db_update('comment_notify')
     ->fields(array(
       'notify' => 0,
     ))
    ->condition('notify_hash', $hash)
    ->execute();
  }
}

That is to say, here:

  $notification = db_select('comment_notify')
      ->fields('comment_notify')
      ->condition('notify_hash', $hash)
      ->execute()->fetchAll();

or here:

  else {
   // Update this notification to be disabled.
   return (bool)db_update('comment_notify')
     ->fields(array(
       'notify' => 0,
     ))
    ->condition('notify_hash', $hash)
    ->execute();
  }

'comment_notify' => {comment_notify}

No?
I'm sorry, I almost do not know Drupal :)

greggles’s picture

Status: Needs review » Fixed

The new database API automatically prefixes tables, so there is no problem with those instances.

Committed to 7.x-1.x - http://drupalcode.org/project/comment_notify.git/commit/d56ea59

I'll probably leave it as part of the dev for a while (that tar file will get re-rolled in the next ~12 hours) so people affected by this bug should wait 12 hours and then upgrade. If there aren't many new bug reports I'll make a new stable release in ~2 weeks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

izmeez’s picture

Issue summary: View changes

Is this going to be added to a new stable release? Thanks.

greggles’s picture