When I try to delete a node I get the following error messages and the node is not deleted.

    Notice: Undefined variable: pid in simple_access_node_delete() (line 263 of C:\xampp\htdocs\drupal\sites\all\modules\simple_access\simple_access.module).
    
    PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pid' in 'where clause': DELETE FROM {simple_access_node} WHERE (pid IS NULL ) ; Array ( ) in simple_access_node_delete() (line 264 of C:\xampp\htdocs\drupal\sites\all\modules\simple_access\simple_access.module).
CommentFileSizeAuthor
#4 unable_to_delete_node-1150112-1.patch504 bytesc31ck

Comments

cybelle’s picture

solution :

db_delete($table)
->condition('pid', $pid)
->execute();

Should be nid

db_delete($table)
->condition('nid', $node->nid)
->execute();

jerodfritz’s picture

this solved the problem for me. there is no pid in the schema in any of those tables.

kscott22’s picture

Worked for me, as well. Been struggling with this one for a while. Yay! Thanks, cybelle!

c31ck’s picture

StatusFileSize
new504 bytes

Fix works, thanks cybelle. I've created a patch for this fix.

tompagabor’s picture

Status: Active » Reviewed & tested by the community

Works fine for me.

anj’s picture

Patch in #4 works fine for me too.

Xomby’s picture

Confirmed, Works for me too. thanks very much for quick fix!

emilkarl’s picture

Works for me as well. Thanks!

roderik’s picture

FYI: this is fixed in 7.x-2.x-dev (from march 12th, 2011. It's the only change since 2.0-beta1.)

flocki’s picture

Thanks! I hope this will make it into beta2

drupal_simply_amazing’s picture

What files in particular can i insert this patch.

diff -Naur original/simple_access.module modified/simple_access.module
--- original/simple_access.module 2011-06-24 10:14:00.000000000 +0200
+++ modified/simple_access.module 2011-06-24 10:15:01.000000000 +0200
@@ -260,7 +260,7 @@
function simple_access_node_delete($node) {
foreach (array('simple_access_node', 'simple_access_owner', 'simple_access_profiles_node') as $table) {
db_delete($table)
- ->condition('pid', $pid)
+ ->condition('nid', $node->nid)
->execute();
}
}
Tnx.

Edit:

Thank you guys. It works on me also.

gordon’s picture

Status: Reviewed & tested by the community » Fixed

Fix is dev

Status: Fixed » Closed (fixed)

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