Once a node has been created, the user cannot edit it. If the user tries, they get the "You can't create more content of type Company, sorry." error message.

I think the problem comes from the use of the $op == prepare check. It also gets called when the user tries to edit a node. Possibly, a second check for $op = update within the $op = prepare loop might help.

CommentFileSizeAuthor
#1 node_limitnumber-edit.patch9.64 KBdavemybes

Comments

davemybes’s picture

StatusFileSize
new9.64 KB

I had a go at doing something for this problem. If I put in a check for the node id (one will be present if the node already exists i.e. the user is editing the node), immediately following if ($op == 'prepare' && $user->uid != 1) { , the edit function now works. I checked and the node limit still works.

I am attaching a patch for this possible fix. Not sure if there's a better way to do it. Oh, the patch also includes some code cleanup (mostly extra spaces added and removed where necessary). Take a look at the Coder module for cleaning up your code (I didn't use it myself on this, but I have found it useful before).

nachenko’s picture

Status: Active » Needs review

F###, I can't apply the patch, don't know why.

Anyway, I read it and applied your fix myself. Additionally, I've moved some hook_nodeapi code to a helper function, as part of my deadly and mad plan to add limits in a per-user basis.

About code cleaning... well, I guess Dreamweaver for Windows is not the right tool for this kind of coding, It looks good here, I'll check the config.

I'm testing here and seems fixed.

I've committed changes. They should appear with date april 23rd in Dev version.

davemybes’s picture

Status: Needs review » Fixed

Awesome! It works for me! Thanks.

For clean code, I wouldn't recommend Dreamweaver. The main problem is that it puts in tabs instead of spaces for indentation. So when I read the code in my text editor, things look a little screwy. See if it has an option to insert spaces instead of tabs.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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