You are here

function video_multidownload_nodeapi in Video 6.2

Same name and namespace in other branches
  1. 5 plugins/video_multidownload/video_multidownload.module \video_multidownload_nodeapi()
  2. 6 plugins/video_multidownload/video_multidownload.module \video_multidownload_nodeapi()

Implementation of hook_nodeapi()

File

plugins/video_multidownload/video_multidownload.module, line 161
Enable multiple file download in video module.

Code

function video_multidownload_nodeapi(&$node, $op, $teaser) {
  if ($node->type == 'video') {
    switch ($op) {
      case 'validate':

        //Validate multi-file download values.
        if (user_access('create multi-file downloads')) {

          //Make sure the user has permission.

          //Checks to make sure either multi-downloads are disabled, or a valid folder is given, or use_play_folder is checked.
          if ($node->disable_multidownload == 0 and !is_dir(getcwd() . '/' . $node->download_folder) and $node->use_play_folder == 0) {
            form_set_error('disable_multidownload', t("Please disable multi-file downloads if you are not going to use the feature."));
            form_set_error('download_folder', t('Download directory does not exist. Make sure it has a trailing forward slash "/".'));
          }
        }
        break;
    }
  }
}