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?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHave 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)
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".
admin/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.
For 1:
For 2:
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;
}