Disable upload and comment for a new content type programmatically

Following code is useful when installing a module that create a new content type programmatically on Drupal 6.x.

Basically, it adds two variables setting default values for comments (core Comment module) and attachments (core Upload module).

Code to write on my_funny_module/my_funny_module.install.

function my_funny_module_install() {
  // Disable attachments
  // Read http://api.drupal.org/api/function/upload_nodeapi/6 on "load"
  variable_set("upload_my_content_type", 0);

  // Disable comments for this content type
  // Read http://api.drupal.org/api/function/comment_form_alter/6
  variable_set('comment_my_content_type', COMMENT_NODE_DISABLED);

  // Install schema as usual (if any)

Note that this code assign only default values for my_content_type: as any content type, this value could be later changed via GUI.

Raise Drupal files upload limit

  1. In your Drupal site, go to admin/settings/uploads
  2. Raise upload limits. If the value you want to insert is greater than PHP allowed value:
  3. On bottom of your .htaccess file (drupal/.htaccess) add these lines:
    # upload settings
    # cfr. http://it.php.net/manual/it/function.ini-set.php
    php_value post_max_size 50M
    php_value upload_max_filesize 50M
    php_value memory_limit 128M

    Change values as you wish.
  4. Return to admin/settings/uploads and watch changes on PHP limit.

See also: