function _revisioning_view_edit_access_callback in Revisioning 6.3
Same name and namespace in other branches
- 8 revisioning.module \_revisioning_view_edit_access_callback()
- 6.4 revisioning.module \_revisioning_view_edit_access_callback()
- 7 revisioning.module \_revisioning_view_edit_access_callback()
Access callback for 'node/%', 'node/%/view' and 'node/%/edit' links that may appear anywhere on the site. At the time that this function is called the CURRENT revision will already have been loaded by the system. However depending on the value of the 'revisioning_view_callback' and 'revisioning_edit_callback' variables (as set on the admin/settings/revisioning page), this may not be the desired revision. If these variables state that the LATEST revision should be loaded, we need to check at this point whether the user has permission to view this revision.
The 'View current' and/or 'Edit current' tabs are suppressed when the current revision is already displayed via one of the Revisions subtabs. The 'View latest' and/or 'Edit latest' tabs are suppressed when the latest revision is already displayed via one of the Revisions subtabs.
Parameters
op, must be one of 'view' or 'edit':
$node:
Return value
FALSE if access to the desired revision is denied
1 string reference to '_revisioning_view_edit_access_callback'
- revisioning_menu_alter in ./
revisioning.module - Implementation of hook_menu_alter().
File
- ./
revisioning.module, line 749 - Allows the creation and modification of pre-published as well as live content while the current revision remains unchanged and publicly visible until the changes have been reviewed by a moderator.
Code
function _revisioning_view_edit_access_callback($op, $node) {
$load_op = _revisioning_load_op($node, $op);
$vid = arg(3);
if (is_numeric($vid)) {
// The View, Edit primary tabs are requested indirectly, in the context of
// the secondary tabs under Revisions, e.g. node/%/revisions/%
if ($load_op == REVISIONING_LOAD_CURRENT && $vid == $node->current_revision_id) {
// Suppress 'View current' and 'Edit current' primary tabs when viewing current
return FALSE;
}
if ($load_op == REVISIONING_LOAD_LATEST && $vid == revisioning_get_latest_revision_id($node->nid)) {
// Suppress 'View latest' and 'Edit latest' primary tabs when viewing latest
return FALSE;
}
}
if ($load_op == REVISIONING_LOAD_LATEST) {
// _revisioning_load_op has already checked permission to view latest
return TRUE;
}
$revision_op = $op == 'view' ? 'view current' : 'edit current';
return _revisioning_node_revision_access($revision_op, $node);
}