Index: view_unpublished.install
===================================================================
RCS file: view_unpublished.install
diff -N view_unpublished.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ view_unpublished.install	21 Oct 2009 06:52:43 -0000
@@ -0,0 +1,7 @@
+<?php
+// $Id$
+
+function view_unpublished_install() {
+  // Make sure that the view_unpublished module runs after other access modules like module_grants.
+  db_query("UPDATE {system} SET weight = 1 WHERE name = 'view_unpublished' and type = 'module'");
+}
Index: view_unpublished.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/view_unpublished/view_unpublished.module,v
retrieving revision 1.2.4.1
diff -u -p -r1.2.4.1 view_unpublished.module
--- view_unpublished.module	30 Aug 2009 19:48:24 -0000	1.2.4.1
+++ view_unpublished.module	21 Oct 2009 06:52:43 -0000
@@ -14,7 +14,7 @@
  * a new permission for each content type.
  */
 function view_unpublished_perm() {
-  $perms = array('view all unpublished content');
+  $perms = array('view all unpublished content', 'view own unpublished content');
 
   foreach (node_get_types() as $type => $name) {
     $perms[] = 'view unpublished ' . $type . ' content';
@@ -29,15 +29,17 @@ function view_unpublished_perm() {
  * Modifies the path node/nid to use our access callback.
  */
 function view_unpublished_menu_alter(&$items) { 
+  $old_access_callback = $items['node/%node']['access callback'];
+
   $items['node/%node']['access callback'] = '_view_unpublished_node_access';
-  $items['node/%node']['access arguments'] = array(1);
+  $items['node/%node']['access arguments'] = array(1, $old_access_callback);
 }
 
 /**
  * Returns true if the user has 'view all unpublished content' or if
  * they have the permission corresponding to the node's content type.
  */
-function _view_unpublished_node_access($node) {
+function _view_unpublished_node_access($node, $old_access_callback) {
   // Only check permissions on nodes that are unpublished.
   if ($node->status == 0) {
     if (user_access('view all unpublished content')) {
@@ -47,8 +49,14 @@ function _view_unpublished_node_access($
     if (user_access('view unpublished ' . $node->type . ' content')) {
       return TRUE;
     }
+
+    if(user_access('view own unpublished content')) {
+      global $user;
+      if($node->uid == $user->uid)
+        return TRUE;
+    }
   }
   
   // If none of the above conditions were satisfied, then use node_access like normal.
-  return node_access('view', $node);
+  return $old_access_callback('view', $node);
 }
