diff --git a/view_unpublished.info b/view_unpublished.info
index 476bb4e..fd16855 100644
--- a/view_unpublished.info
+++ b/view_unpublished.info
@@ -5,3 +5,5 @@ package = "Permissions"
 
 ; Core version (required)
 core = 7.x
+
+files[] = view_unpublished_handler_filter_node_status.inc
diff --git a/view_unpublished.module b/view_unpublished.module
index f5630a9..411e7dd 100644
--- a/view_unpublished.module
+++ b/view_unpublished.module
@@ -87,4 +87,40 @@ function view_unpublished_get_configured_types($reset = FALSE) {
   static $types = array();
   $types = (empty($types) || $reset == TRUE) ? node_permissions_get_configured_types() : $types;
   return $types;
-}
\ No newline at end of file
+}
+
+/**
+ * Implementation of hook_views_data_alter()
+ */
+function view_unpublished_views_data_alter(&$data) {
+  // published status + extra handler is taken over by our handler
+  $data['node']['status_extra']['filter']['handler'] = 'view_unpublished_handler_filter_node_status';
+}
+
+
+/**
+ * Implementation of hook_views_handlers()
+ */
+function view_unpublished_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'view_unpublished'),
+    ),
+    'handlers' => array(
+      'view_unpublished_handler_filter_node_status' => array(
+        'parent' => 'views_handler_filter_node_status',
+      ),
+    ),
+  );
+}
+
+/**
+ * Implementation of hook_views_query_substitutions().
+ */
+function view_unpublished_views_query_substitutions() {
+  foreach (node_type_get_types() as $type => $name) {
+    $substitutions["***VIEWUNPUBLISHED_$type***"] = intval(user_access('view any unpublished ' . $type . ' content'));
+  }
+
+  return $substitutions;
+}
