Commit b6c069ad authored by Dries's avatar Dries
Browse files

- Patch #20295 by pyromanfo, webchick, Gurpartap Singh et al: allow forum...

- Patch #20295 by pyromanfo, webchick, Gurpartap Singh et al: allow forum topics to be custom node types.
parent 5644ad02
...@@ -57,6 +57,8 @@ Drupal 6.0, xxxx-xx-xx (development version) ...@@ -57,6 +57,8 @@ Drupal 6.0, xxxx-xx-xx (development version)
- File handling improvements: - File handling improvements:
* Entries in the files table are now keyed to a user, and not a node. * Entries in the files table are now keyed to a user, and not a node.
* Added re-usable validation functions to check for uploaded file sizes, extensions, and image resolution. * Added re-usable validation functions to check for uploaded file sizes, extensions, and image resolution.
- Forum improvements:
* Any node type may be posted in a forum.
- Added support for OpenID. - Added support for OpenID.
- Added support for configurable actions. - Added support for configurable actions.
- Made user profiles easier to theme by using array rendering and supplying template files. - Made user profiles easier to theme by using array rendering and supplying template files.
......
...@@ -88,7 +88,11 @@ function blog_feed_user($uid = 0) { ...@@ -88,7 +88,11 @@ function blog_feed_user($uid = 0) {
$channel['title'] = $account->name ."'s blog"; $channel['title'] = $account->name ."'s blog";
$channel['link'] = url("blog/$uid", array('absolute' => TRUE)); $channel['link'] = url("blog/$uid", array('absolute' => TRUE));
$channel['description'] = $term->description; $channel['description'] = $term->description;
node_feed($result, $channel);
while ($row = db_fetch_object($result)) {
$items[] = $row->nid;
}
node_feed($items, $channel);
} }
/** /**
...@@ -99,7 +103,12 @@ function blog_feed_last() { ...@@ -99,7 +103,12 @@ function blog_feed_last() {
$channel['title'] = variable_get('site_name', 'Drupal') .' blogs'; $channel['title'] = variable_get('site_name', 'Drupal') .' blogs';
$channel['link'] = url('blog', array('absolute' => TRUE)); $channel['link'] = url('blog', array('absolute' => TRUE));
$channel['description'] = $term->description; $channel['description'] = $term->description;
node_feed($result, $channel);
while ($row = db_fetch_object($result)) {
$items[] = $row->nid;
}
node_feed($items, $channel);
} }
/** /**
......
...@@ -5,16 +5,42 @@ ...@@ -5,16 +5,42 @@
* Implementation of hook_install(). * Implementation of hook_install().
*/ */
function forum_install() { function forum_install() {
// Create tables. // Create the forum vocabulary. Assign the vocabulary a low weight so
drupal_install_schema('forum'); // it will appear first in forum topic create and edit forms.
$vocabulary = array(
'name' => t('Forums'),
'multiple' => 0,
'required' => 1,
'hierarchy' => 1,
'relations' => 0,
'module' => 'forum',
'weight' => -10,
'nodes' => array('forum' => 1),
);
taxonomy_save_vocabulary($vocabulary);
variable_set('forum_nav_vocabulary', $vocabulary['vid']);
}
/**
* Remove forum table; forums now use the general term_node table to support multiple
* node types.
*/
function forum_update_6001() {
$ret = array();
$ret[] = update_sql("DROP TABLE {forum}");
return $ret;
} }
/** /**
* Implementation of hook_uninstall(). * Implementation of hook_uninstall().
*/ */
function forum_uninstall() { function forum_uninstall() {
// Remove tables. $vid = variable_get('forum_nav_vocabulary', '');
drupal_uninstall_schema('forum'); // Delete the vocabulary.
taxonomy_del_vocabulary($vid);
db_query("DELETE FROM {node} WHERE type = 'forum'"); db_query("DELETE FROM {node} WHERE type = 'forum'");
variable_del('forum_containers'); variable_del('forum_containers');
......
This diff is collapsed.
<?php
// $Id$
function forum_schema() {
$schema['forum'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)
),
'indexes' => array(
'nid' => array('nid'),
'tid' => array('tid')
),
'primary key' => array('vid'),
);
return $schema;
}
...@@ -1944,28 +1944,31 @@ function node_block($op = 'list', $delta = 0) { ...@@ -1944,28 +1944,31 @@ function node_block($op = 'list', $delta = 0) {
/** /**
* A generic function for generating RSS feeds from a set of nodes. * A generic function for generating RSS feeds from a set of nodes.
* *
* @param $nodes * @param $nids
* An object as returned by db_query() which contains the nid field. * An array of node IDs (nid).
* @param $channel * @param $channel
* An associative array containing title, link, description and other keys. * An associative array containing title, link, description and other keys.
* The link should be an absolute URL. * The link should be an absolute URL.
*/ */
function node_feed($nodes = 0, $channel = array()) { function node_feed($nids = array(), $channel = array()) {
global $base_url, $language; global $base_url, $language;
if (!$nodes) { if (!$nids) {
$nodes = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10)); $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
while ($row = db_fetch_object($result)) {
$nids[] = $row->nid;
}
} }
$item_length = variable_get('feed_item_length', 'teaser'); $item_length = variable_get('feed_item_length', 'teaser');
$namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"'); $namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"');
$items = ''; $items = '';
while ($node = db_fetch_object($nodes)) { foreach ($nids as $nid) {
// Load the specified node: // Load the specified node:
$item = node_load($node->nid); $item = node_load($nid);
$node->build_mode = NODE_BUILD_RSS; $node->build_mode = NODE_BUILD_RSS;
$link = url("node/$node->nid", array('absolute' => TRUE)); $link = url("node/$nid", array('absolute' => TRUE));
if ($item_length != 'title') { if ($item_length != 'title') {
$teaser = ($item_length == 'teaser') ? TRUE : FALSE; $teaser = ($item_length == 'teaser') ? TRUE : FALSE;
......
...@@ -1422,7 +1422,12 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { ...@@ -1422,7 +1422,12 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
$channel['description'] = $term->description; $channel['description'] = $term->description;
$result = taxonomy_select_nodes($tids, $terms['operator'], $depth, FALSE); $result = taxonomy_select_nodes($tids, $terms['operator'], $depth, FALSE);
node_feed($result, $channel);
while ($row = db_fetch_object($result)) {
$items[] = $row->nid;
}
node_feed($items, $channel);
break; break;
default: default:
drupal_not_found(); drupal_not_found();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment