You are here

function _blog_post_exists in Blog 3.x

Same name and namespace in other branches
  1. 8.2 blog.module \_blog_post_exists()

Helper function to determine if a user has blog posts already.

1 call to _blog_post_exists()
blog_page_user_access in ./blog.module
Access callback for user blog pages.

File

./blog.module, line 109
Enables multi-user blogs.

Code

function _blog_post_exists($account) {
  return (bool) Database::getConnection()
    ->select('node_field_data', 'n')
    ->fields('n', [
    'nid',
  ])
    ->condition('type', 'blog')
    ->condition('uid', $account
    ->id())
    ->condition('status', 1)
    ->range(0, 1)
    ->addTag('node_access')
    ->execute()
    ->fetchField();
}