You are here

function blog_access in Drupal 6

Same name and namespace in other branches
  1. 4 modules/blog.module \blog_access()
  2. 5 modules/blog/blog.module \blog_access()

Implementation of hook_access().

File

modules/blog/blog.module, line 31
Enables keeping an easily and regularly updated web page or a blog.

Code

function blog_access($op, $node, $account) {
  switch ($op) {
    case 'create':

      // Anonymous users cannot post even if they have the permission.
      return user_access('create blog entries', $account) && $account->uid ? TRUE : NULL;
    case 'update':
      return user_access('edit any blog entry', $account) || user_access('edit own blog entries', $account) && $node->uid == $account->uid ? TRUE : NULL;
    case 'delete':
      return user_access('delete any blog entry', $account) || user_access('delete own blog entries', $account) && $node->uid == $account->uid ? TRUE : NULL;
  }
}