I tried to fix the directory.module so that it would actually work properly (please note I renamed it to category.module), but I still am receiving this problem on Drupal v4.6.2, I searched on Google and in the forums, and kept finding the same suggestion to look for extra whitespace or other characters before <?php
or after ?>
here is the error message:
warning: Cannot modify header information - headers already sent by (output started at /home/path/drupal/modules/authors.module:1) in /home/path/drupal/includes/common.inc on line 192.
Line 192 on common.inc seems to be redirecting the current page, this error shows up when I submit any type of form on drupal:
header('Location: '. $url);
Here is the modified category.module (previously directory.module):
<?php
/* $Id: directory.module,v 1.5 2005/09/26 18:05:31 mathias Exp $ */
/* Authored by Matt Westgate */
/* Original Frontier implementation by John VanDyk */
/********************************************************************
* Drupal Hooks :: General Overview
********************************************************************/
/**
* Implementation of hook_help().
*/
function category_help($section = 'admin/help#category') {
switch ($section) {
case 'admin/modules#description':
return t('Create a category of resources based on node metadata.');
}
}
/**
* Implementation of hook_menu().
*/
function category_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array('path' => 'category', 'title' => t('Categories'), 'callback' => 'category_page', 'access' => user_access('access content'));
$items[] = array('path' => 'category/term', 'title' => t('Advanced category search'), 'callback' => 'category_term_page', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
$items[] = array('path' => 'category/random', 'title' => t('Random category link'), 'callback' => 'category_random', 'access' => user_access('access content'), 'type' => MENU_CALLBACK);
}
return $items;
}
/********************************************************************
* Drupal Hooks :: Core Hooks
********************************************************************/
/**
* Implementation of hook_settings().
*/
function category_settings() {
$output = '';
if (function_exists('taxonomy_help')) {
$vocs[0] = '<'. t('none') .'>';
foreach (taxonomy_get_vocabularies() as $vid => $voc) {
$vocs[$vid] = $voc->name;
}
}
foreach (node_list() as $type) {
$nodetypes[$type] = node_invoke($type, 'node_name');
}
$output .= form_checkboxes(t('Which node types should not be listed in the category'), 'category_no_nodes', variable_get('category_no_nodes', array()), $nodetypes, NULL, NULL, TRUE);
$output .= form_select(t('Which vocabularies should be displayed on the category main page'), 'category_vocabularies_root', variable_get('category_vocabularies_root', ''), $vocs, t('The vocabularies that will visible at the root level of the category page.'), 0, TRUE);
$output .= form_textfield(t('Resource count threshold to display subcategories'), 'category_cat_res_count', variable_get('category_cat_res_count', 10), 5, 6, t('If a category has fewer than this number of resources, the category will try to display the resources available in subcategories.'));
$output .= form_textfield(t('Number of resources to display for each visible subcategory'), 'category_subcat_res_count', variable_get('category_subcat_res_count', 5), 5, 6, t('If subcategories are visible, how many resources for each subcategory should be displayed?'));
$output .= form_textarea(t('Explanation guidelines'), 'category_help', variable_get('category_help', ''), 70, 5, t('This text will be displayed at the top of the category pages. It is useful for helping or instructing your users.'));
return $output;
}
/********************************************************************
* Module Specific :: Public Functions
********************************************************************/
/**
* This is the Controller for category viewing.
*
* Note the menu system will take care of passing in the $tid, which is the
* unique ID of the category requested for viewing.
*/
function category_page($tid = null, $filter = null, $fid = null) {
$output = '
'. variable_get('category_help', '') .'
';
if ($tid > 0) { //Display a category view
category_set_breadcrumb($tid, 'Home');
$output .= category_display_category($tid);
$output .= category_display_resource($tid, $filter, $fid);
if (!$output) {
$output .= t('
There are no resources to display in this category.