I want to have a 'wiki' content type that is editable by everyone and that everyone is able to view revisions on. However, I don't want users to see revisions to other content types (which I want to be able to see). Right now the access control is view revision for all nodes rather than specific content types. Does anyone have any ideas on how to do this?

Thanks
John

Comments

jadams1-1’s picture

Does anyone have any insights into this? I appreciate any help.

Thanks

ekrispin’s picture

Couldn't find any lead to implement it...

jgoldfeder’s picture

The solution works perfectly, but is not a good solution as it requires editing the core node module which makes upgrades one more step difficult. If someone comes up with a better one that does not require editing core, I'd be happy to adopt it myself.

The solution is to only allow access to see the revisions if you have access to edit the node. This makes perfect sense as if you can't edit it, why should you see revisions?

Here is how it works.

You have to edit three lines.

Line 1213:
FROM
$revisions_access = ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node) && db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', arg(1))) > 1);
TO
$revisions_access = ((user_access('view revisions') || user_access('administer nodes')) && node_access('update', $node) && db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', arg(1))) > 1);

LINE 2397:
FROM
if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
TO
if ((user_access('view revisions') || user_access('administer nodes')) && node_access('update', $node)) {

LINE 2406:
FROM
if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
TO
if ((user_access('view revisions') || user_access('administer nodes')) && node_access('update', $node)) {

And that's it. It is pretty simple.

Hope this helps someone.

jgoldfeder’s picture

Update: On drupal 5.10 the line numbers are 1263, 2441, & 2450.

jgoldfeder’s picture

anyone figured out how to do this in 6?

kvarnelis’s picture

Before anybody goes and patches core for good, please note that this functionality is not complete.

There is a very good use for individuals to see revisions for content types that they cannot access: locked pages on wikis.

Take a highly-controversial page that is locked to all but top-level editors (imagine Israel or George H. W. Bush). You would want revision history to be visible, but you would not want it to be editable.

Another example, is that I am putting up a book and I'd like to have the revisions visible so that as I change the text to incorporate comments, readers can see the changes and understand why the comments were made on earlier versions.

On the other hand, I do NOT want other people to edit my text directly.

http://www.varnelis.net