function _blog_post_exists in Blog 8.2
Same name and namespace in other branches
- 3.x 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 108 - 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();
}