| 1 |
// $Id$
|
| 2 |
|
| 3 |
archiver.module installation instructions
|
| 4 |
|
| 5 |
1) Copy this directory to your modules directory
|
| 6 |
2) Enable the module at: administer -> modules
|
| 7 |
3) Configure the module settings at: administer -> settings -> archiver
|
| 8 |
4) Assign permissions to user roles at: administer -> access control
|
| 9 |
5) Optionally, patch the core (see below why).
|
| 10 |
patch -p0 < archiver/patches/node.module.patch
|
| 11 |
patch -p0 < taxonomy/patches/node.module.patch
|
| 12 |
|
| 13 |
Read more about http://drupal.org/node/60108
|
| 14 |
|
| 15 |
PATCHING THE CORE:
|
| 16 |
==================
|
| 17 |
Unfortunately, as of now, hiding of archived nodes
|
| 18 |
on regular pages (e.g. front page, category listings) is
|
| 19 |
implemented by core hacks (see below).
|
| 20 |
A possible workaround would be storing the promote variable and all
|
| 21 |
term ids into the archiver table and DELETE FROM term_node
|
| 22 |
WHERE nid = %d and update node.promote to 1. However, if such
|
| 23 |
nodes would be edited (promoted, terms),we need to make sure
|
| 24 |
that these newly entered parameters are saved in archiver
|
| 25 |
and immediately overwritten (unless unarchiving was selected
|
| 26 |
at the same time). Still, it would not be clear whether a node
|
| 27 |
used to be promoted/terms from the edit form of the archived node.
|
| 28 |
|
| 29 |
5) This is what the supplied patches do: Edit node.module at around line #2374:
|
| 30 |
|
| 31 |
From
|
| 32 |
function node_page_default() {
|
| 33 |
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
|
| 34 |
|
| 35 |
to
|
| 36 |
// HACK (archiver module) to hide archived nodes from the front page
|
| 37 |
if(variable_get('archiver_remove_from_frontpage', FALSE)) {
|
| 38 |
$query = db_rewrite_sql('SELECT DISTINCT n.nid, n.sticky, n.created FROM {node} AS n LEFT JOIN {archiver} AS a ON n.nid = a.nid WHERE a.nid IS NULL AND n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC');
|
| 39 |
$result = pager_query($query, variable_get('default_nodes_main', 10));
|
| 40 |
|
| 41 |
} else {
|
| 42 |
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
|
| 43 |
}
|
| 44 |
|
| 45 |
|
| 46 |
6) Optionally, if you want to hide archived nodes from all category listings,
|
| 47 |
edit taxonomy.module at around line #1230:
|
| 48 |
|
| 49 |
From
|
| 50 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
|
| 51 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
|
| 52 |
|
| 53 |
to
|
| 54 |
|
| 55 |
//HACK (archiver module) to hide archived nodes from the front page
|
| 56 |
if(variable_get('archiver_remove_from_categories', FALSE)) {
|
| 57 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN ( {term_node} tn LEFT JOIN {archiver} a ON tn.nid = a.nid ) ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND a.nid IS NULL ORDER BY '. $order;
|
| 58 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN ( {term_node} tn LEFT JOIN {archiver} a ON tn.nid = a.nid ) ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 AND a.nid IS NULL';
|
| 59 |
}
|
| 60 |
else {
|
| 61 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
|
| 62 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
|
| 63 |
}
|
| 64 |
|
| 65 |
and around line #1240
|
| 66 |
|
| 67 |
From
|
| 68 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order;
|
| 69 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres;
|
| 70 |
|
| 71 |
to
|
| 72 |
//HACK (archiver module) to hide archived nodes from the front page
|
| 73 |
if(variable_get('archiver_remove_from_categories', FALSE)) {
|
| 74 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' LEFT JOIN {archiver} a ON tn0.nid = a.nid WHERE a.nid IS NULL AND n.status = 1 '. $wheres .' ORDER BY '. $order;
|
| 75 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' LEFT JOIN {archiver} a ON tn0.nid = a.nid WHERE a.nid IS NULL AND n.status = 1 '. $wheres;
|
| 76 |
}
|
| 77 |
else {
|
| 78 |
$sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order;
|
| 79 |
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres;
|
| 80 |
}
|
| 81 |
|
| 82 |
|