function theme_view_uploaded_files_forbidden in iTweak Upload 6.2
Implementation of theme_view_uploaded_files_forbidden(). Theme the attachments output when user is not allowed to view them.
Parameters
$node: Node on which the uploaded files would be displayed.
1 theme call to theme_view_uploaded_files_forbidden()
- itweak_upload_nodeapi in ./
itweak_upload.module - Implementation of hook_nodeapi().
File
- ./
itweak_upload.module, line 1504 - iTweakUpload - Tweak attachments display and file upload forms.
Code
function theme_view_uploaded_files_forbidden($node) {
global $user;
static $authenticated_view_uploaded_files;
if (!$user->uid) {
if (!isset($authenticated_view_uploaded_files)) {
// We only output any link if we are certain, that users get permission
// to view uploaded files by logging in. We also locally cache this information.
$authenticated_view_uploaded_files = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'view uploaded files'));
}
if ($authenticated_view_uploaded_files) {
$destination = drupal_get_destination();
if (variable_get('user_register', 1)) {
// Users can register themselves.
$html = t('<a href="@login">Login</a> or <a href="@register">register</a> to view attached files', array(
'@login' => url('user/login', array(
'query' => $destination,
)),
'@register' => url('user/register', array(
'query' => $destination,
)),
));
}
else {
// Only admins can add new users, no public registration.
$html = t('<a href="@login">Login</a> to view attached files', array(
'@login' => url('user/login', array(
'query' => $destination,
)),
));
}
$div_class = 'itu-attachment-forbidden';
$html = '<div class="' . $div_class . '">' . $html . '</div>';
return $html;
}
}
}