[Imc-drupal-dev] hiding articles in Drupal 5.1 - ideas?

Zoltan Varady drifter at zpok.hu
Thu Mar 1 02:33:33 PST 2007


On 2007.03.01., at 4:50, Sebastian wrote:

> kia ora koutou...
>
> we at Aotearoa IMC have a test site with Drupal running (again),  
> version
> 5.1. checkout http://dev.indymedia.org.nz.
>
> does anybody of you have a good idea how to handle the hiding of
> articles? at the moment, our prospective process seems rather
> tedious:
>
> 1) set category to 'hidden'
> 2) add an HTML snippet to have a big notice in red, saying: 'this
>    article is hidden'
> 3) change the author of the article, so she cannot change itback to
>    non-hidden

Hi, we're just experimenting with moving to Drupal at IMC Hungary.  
The approach I've taken is to have a seperate vocabulary for hidden  
articles. Then I wrote a small module that hides the vocabulary  
dropdown for normal users, and shows it for editors. Here's the snippet:

<?php
function imc_form_alter($form_id, &$form) {
	global $user;
	if (!in_array('admin',$user->roles) && !in_array('editor',$user- 
 >roles)) {
		if ($form_id = 'article_node_form') {
			// hide hidden article vocabulary for non-editors	
			$form['taxonomy'][1] = null;
			// hide dossier vocabulary for non-editors
			$form['taxonomy'][3] = null;

		}
	}
}
?>


cheers,

drifter/IMC hungary



More information about the Imc-drupal-dev mailing list