I want to achieve that user can view the unpublished content once they have logged in .

Unpublished content should be displayed as a notification like Topic(1).

How to achieve this ? Is there solution to achieve this?


3 Answers 3


Part 1 - Notifications

Have a look at the Menu Badges module to add such notifications to any menu item and/or menu tab of your choice.

Here are some details about it (from its project page):

Provides a method for adding iOS-style badges to menu items. (see screenshot)

enter image description here

Adding Badges to Menus

Once enabled, go to Administration > Structure > Menus, and click "list links" next to the menu containing the target item. Click "edit" next to the item and select the badge to display with the Display Menu Badge select box.

Adding Badges to Tabs

For adding badges to menu tabs, there is a tab under Administration > Structure > Menus called "Tab Menu Badges". Search for the menu router path of the tab you want to alter, then select a badge from the corresponding select box.

Badge Types

The module includes five example badges, and new badges can be created easily with Views. Modules can also supply their own badges with a hook implementation. See the README.txt file for details.

Because of how it integrates with the Views module, you basically reduce the solution for any type of notification to something like "Just create an appropriate view of it".

Video tutorials:

Part 2 - View unpublished content

You may want/have to combine this also with using the view_unpublished module. Some details from its project page:

This module allows you to grant access for specific user roles to view unpublished nodes of a specific type. Access control is quite granular in this regard.


You can set the Permissions to allow/deny unpublished content access.

user can view the unpublished content once they have logged in

May be the module Notify (https://www.drupal.org/project/notify) can do this job ?


Well it depends on the kind of notification system you are looking to have in place.

  1. Is it goign to be real time? So soon a node is created with status 0(unpublish) it triggers system wide notification which can visible real time to all allowed users.
  2. Or is it ok to update the count on page load?

For 1:

  • For realtime notification it could be polling based(not recommened). You can try for message module
  • If you want push notification you will need a combination of a queue where you can send your notification, nodejs process which can read the queue and socket.io to emit to browser.

For 2:

  • (Custom Way)If its ok to update the count on page load, its relatively much easy to implement. All you need to do is query the database and theme the output in form of custom block,

You can call this function inside a custom block and place the block in any region you want to show count of unpublished content. Every time the block will load it will query and get the count but it wouldn't be real time.

function _get_node_count_by_status($status = 0) {
      $query = db_select('node', 'n');
      $query->fields('n', array('nid'));
      $query->condition('n.status', $status);
      $node_count = $query->execute()->rowCount();
      return $node_count;

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.