2

If you enable the Blog core module in D7, you have a multiuser blog. It will produce a blog front page for all blog entries published at the path /blog. It is just like the ordinary front page <front>, but only show nodes of type "blog". By default, all published blog nodes appear on the blog front page.

For the site's default front page there is checkbox "Promoted to front page" under "Publishing options". Unchecking that prevents the node from appearing on the default front page.

Adding a similar checkbox field named "Promoted to blog front page" to the "blog" content type will of course do nothing by itself.

I want to use this field to control whether a blog node appear on blog front page, but have not found a "hook" or a "preprocess-function" or similar Drupal-thing that let me do so with the view of blog teasers that the core blog module produces.

I know I can do this by replacing the blog core module with my own, using Views to produce the list of teasers for the blog front page.

But in this question, I am looking for a way to do this with the view produced by the core blog module?

Is this possible, or must I use Views if I want this?

1 Answer 1

3

The blog module builds this page in the function blog_page_last().

The query in blog_page_last() does have a node_access tag so you could use hook_query_TAG_alter() to add a condition but may be tricky to just target that one query on that page.

I think a better option would be to use hook_menu_alter() to change the callback for the blog menu item to a function in your own module. In this function you can just copy the code from blog_page_last() but add a additional condition for your new promoted field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.