This is a simple and quick mod I did myself to the taxonomy module in the block function. It changes your block display from an order of last updated content to alphabetical by term names.
Apply this mod by overwriting lines ranging from about 95-116 (V4.5 module) containing "Function taxonomy_block" code.
Original posting on this topic can be found http://drupal.org/node/20280
//Overwrite with this code around lines 95-116, the FUNCTION "taxonomy_block".
// Function edited by VideoJunky 4/14/05
/**
* Implementation of hook_block().
*
* Generates a block with all categories listed in alphabetical order.
*/
function taxonomy_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('Categories');
return $blocks;
}
else if (user_access('access content')) {
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE n.status = 1 GROUP BY d.tid, d.name ORDER BY d.name ASC, d.name");
$items = array();
while ($category = db_fetch_object($result)) {
$items[] = l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid);
}
$block['subject'] = t('Categories');
$block['content'] = theme('item_list', $items);
return $block;
}
}
I'm writing an encyclopedia module, and am having a little difficulty... I'm trying to upload an image from the node/x/edit but seem to not be able to. I'm using Konqueror, so I can see the "Are you sure you want to upload these files" dialog come up-- verify it's working you see. But I can't seem to figure out the file_ hooks... can anyone help please?
I'm running 4.6RC, which e-commerce should I use: CVS, the one in the sandbox, or 4.5? I tried to wait for the release but I need to get some stuff set up now.
I'm trying to update a module (my first time trying something on the code level of PHP). I think I have almost everything working (after searching other posts, etc.). The exception is found in the following lines of the site_map module:
$result = db_query('SELECT DISTINCT t.tid, n.nid FROM {term_node} t '. _node_access_join_sql() .'INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND '. _node_access_where_sql());
$result = db_query("SELECT DISTINCT t.tid, n.nid FROM {term_node} t, {node} n ". _node_access_join_sql() ." WHERE t.nid = n.nid AND n.status = 1 AND n.type = '%s' AND ". _node_access_where_sql(), $type);
I have replaced the "node" with the "_node" and tried adding in a "db_rewrite_sql()" statement to each of these lines according to the patch discussion I found at http://drupal.org/node/17666. My knowledge of PHP syntax (or anything PHP, for that matter) has prevented me from success. My attempted patch is:
$result = db_query(db_rewrite_sql('SELECT DISTINCT(n.nid), t.tid FROM {term_node} t '. _node_access_join_sql() .'INNER JOIN {node} n ON t.nid = n.nid WHERE n.status = 1 AND '. _node_access_where_sql()));
$result = db_query(db_rewrite_sql('SELECT DISTINCT(n.nid), t.tid FROM {term_node} t, {node} n ". _node_access_join_sql() ." WHERE t.nid = n.nid AND n.status = 1 AND n.type = '%s' AND ". _node_access_where_sql(), $type));
I'm working on a module (discusspoll) which I'm testing at OurOpinion.com
My question is, where should I look, in terms of documentation, to get started for implementing/setting things up so that I can feed "discussion polls" to other sites via RSS? I'm assuming that my module output has to be XHTML compliant for this to work.