Superceeded

Hidden module now available http://drupal.org/project/hidden notes about it on https://en.wiki.aktivix.org/IMC-Drupal/Development/Hiddens

For Historical purposes

Nodes

Most (all?) IMCs are creating a vocabulary for article type and including in this hidden topic(s).

phptemplate theme

Hiddens want to have a robots no index tag, may want to be styled differently. If you use a phptemplate theme this can be done by adding a variable $hidden available in your node.tpl.php and page.tpl.php files

Create (or add to) template.php

<?php
function _phptemplate_variables($hook, $vars) {
  static $allhidden;
  $allhidden = is_bool($allhidden) ? $allhidden : true;

  switch ($hook) {
    case 'node':
      $a = array(2,4,5); # hidden taxonomy terms - make into a drupal get var?
      foreach( $a as $n ) {
        if ( array_key_exists($n, $vars['node']->taxonomy)) {
          $vars['hidden'] = true;
          break;
        } else {
          $vars['hidden'] = false;
        }
      }
      if (! $vars['hidden']) { $allhidden = false; } 
      break;
    case 'page':
      $vars['hidden'] = $allhidden;
      break;
  }

  return $vars;
}

?>

Edit the array for $a with the tid for your hidden terms. Then you can use it in your templates.

eg in page.tpl.php where $hidden is true if all the articles on the page are hidden

  <?php if ($hidden) : ?>
    <meta name="robots" content="noindex,nofollow">
  <?php endif; ?>

and in node.tpl.php

<div class="node<?php print ($sticky) ? " sticky" : "";
                      print ($hidden) ? " hidden" : ""; } ?>">

Comments

"Comments are not nodes" as they say.

At the moment most (all?) IMCs are unpublishing comments, which rather tham hiding them makes them invisible to anyone except admins.

Alternatives seems to be:

  • patching the comment.module with all the upgrade maintainence etc. Adding 'hidden' to 'published' and 'unpublished' or using 'unpublished' and making it visible to non-admins
  • making some alternative module to see 'unpublished' comments

(Note: the interesting function in comment.module to start is comment_render())

-- WikiKes - 22 May 2006
-- WikiKes - 23 Jul 2007 - archived
Topic revision: r3 - 30 Aug 2007, WikiKes
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback