farjam
farjam

Reputation: 2299

Drupal7: Change node permission programmatically

I'm creating a custom Drupal 7 module and within my module I'm creating a node programmatically. In summary, it's something like this:

$node = new stdClass();
$node->type = 'donation';
node_object_prepare($node);
$node->title = 'Donation made on ' . date('r');
node_save($node);

How can I modify/set the permission for this dynamically created node so it's only accessible to admins?

Upvotes: 2

Views: 1421

Answers (1)

farjam
farjam

Reputation: 2299

I used Content Access module and it solved my problem.

Upvotes: 1

Related Questions