From 475e9a72efadf35e891cb97bc49a976b76bc327f Mon Sep 17 00:00:00 2001 From: Fabio Varesano Date: Wed, 28 Jun 2006 18:46:53 +0000 Subject: Patch #69653 comment 5 by agilpwc (http://drupal.org/user/49395) Prompt Anymous Users to Log In to View Video Adds a 'play video' permission. Users without it will display "login or register to play video or download" link instead of "play or download". --- video.module | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/video.module b/video.module index 1fe2f30..5fc7726 100644 --- a/video.module +++ b/video.module @@ -99,7 +99,7 @@ function video_menu($may_cache) { $items[] = array('path' => 'node/'. arg(1) .'/play', 'title' => t('play'), 'callback' => 'video_play', - 'access' => user_access('access video'), + 'access' => user_access('play video'), 'weight' => 3, 'type' => MENU_LOCAL_TASK); } @@ -142,11 +142,20 @@ function video_link($type, $node = NULL) { $display_download_link = variable_get('video_displaydownloadlink', 1); } - if (variable_get('video_displayplaylink', 1)) { - $link .= l(t('play'), "node/$node->nid/play", array('class' => 'outgoing', 'title' => t('play %link', array('%link' => $node->title)))); - $link .= ($display_download_link == 1) ? ' ' . t('or') . ' ' : ' | '; + if (user_access('play video')) { + if (variable_get('video_displayplaylink', 1)) { + $link .= l(t('play'), "node/$node->nid/play", array('class' => 'outgoing', 'title' => t('play %link', array('%link' => $node->title)))); + $link .= ($display_download_link == 1) ? ' ' . t('or') . ' ' : ' | '; + } } - if ($display_download_link == 1) { + else { + $link .= l(t('login'), "user/login", array('class' => 'outgoing', 'title' => t('login to your account'))); + $link .= ' ' . t('or') . ' '; + $link .= l(t('register'), "user/register", array('class' => 'outgoing', 'title' => t('create a new account'))); + $link .= t(' to play video'); + $link .= ($display_download_link == 1) ? ' ' . t('or') . ' ' : ' | '; + } + if ($display_download_link == 1) { $link .= l(t('download'), "node/$node->nid/download", array('class' => 'outgoing', 'title' => t('download %link', array('%link' => $node->title)))); $link .= ' | '; } @@ -218,7 +227,7 @@ function video_feed() { * array of permissions */ function video_perm() { - $array = array('create video', 'access video', 'administer video', 'download video', 'view play counter', 'view download counter', 'edit own video'); + $array = array('create video', 'access video', 'administer video', 'play video', 'download video', 'view play counter', 'view download counter', 'edit own video'); return $array; } -- cgit v1.2.3