You are here

function _video_download_goto in Video 6.2

Same name and namespace in other branches
  1. 5 video.module \_video_download_goto()
  2. 6 video.module \_video_download_goto()

Forward user directly to the file for downloading

2 calls to _video_download_goto()
video_download in ./video.module
Redirects to download the video file.
video_multidownload_download in plugins/video_multidownload/video_multidownload.module

File

./video.module, line 1302
video.module

Code

function _video_download_goto($node) {
  if (user_access('download video')) {
    if (variable_get('video_downloadcounter', 1)) {
      db_query("UPDATE {video} SET download_counter = download_counter + 1 where vid = %d", $node->vid);

      //Increment download counter.
    }

    // let the submodule handle the real download logic
    module_invoke('video_' . $node->vtype, 'v_download', $node);
  }
  else {

    //If the user does not have access to download videos.
    drupal_set_message(t('You do not have permission to download videos.'), 'error');
    drupal_goto("node/" . $node->nid);

    //Use the nid we just loaded to go back to the node page.
  }
}