Use node_access to check create permission

DeFr - June 16, 2009 - 15:27
Project:Popups: Add and Reference
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Right now, the code checks if the user as the right to create a new node of a given type using user_access("create $type content"); . While that's the standard permission name for node type created by node.module, it's not always the case. I would suggest moving to node_access('create', $type) which is designed exactly for the purpose of checking if the user has the right to create a node of a given type.

Attached patch does that.

AttachmentSize
popups_reference_node_access.patch864 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.