Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've been staring at the code snippet below for 10 minutes now, and I just can't find a valid reason for the second call to user_access
. So either I'm missing something (not unlikely :) ), or it can go.
/**
* Implementation of hook_nodeapi_view().
*/
function upload_nodeapi_view($node, $teaser, $page) {
if (isset($node->files) && user_access('view uploaded files')) {
// Add the attachments list to node body with a heavy
// weight to ensure they're below other elements
if (count($node->files)) {
if (!$teaser && user_access('view uploaded files')) {
$node->content['files'] = array(
'#markup' => theme('upload_attachments', $node->files),
'#weight' => 50,
);
}
}
upload_nodeapi_links($node, $teaser);
}
}
Comment | File | Size | Author |
---|---|---|---|
upload-user-access.patch | 909 bytes | mr.baileys | |
Comments
Comment #1
Dries CreditAttribution: Dries commentedYou're right, Mr. Baileys! Committed to CVS HEAD. Thanks.