When (in my case, anonymous) users have no vocabulary permissions at all, the category fieldset is still shown, albeit empty. The vocabularies and their terms are hidden perfectly, but the empty fieldset probably confuses users into thinking 'Is there something wrong here? Shouldn't I be able to assign terms to my piece of content?'

Is it possible to hide the fieldset when a role doesn't have any vocab permissions at all?

Comments

douggreen’s picture

My categories don't display in a fieldset, so I don't see the problem. Could it be related to your theme or another module? Please elaborate.

brunodbo’s picture

As far as I can tell, the taxonomy module adds a fieldset if the taxonomy form on node pages has more than one element. I think this is the code in taxonomy.module that does this (line 748):

 if (is_array($form['taxonomy']) && !empty($form['taxonomy'])) {
      if (count($form['taxonomy']) > 1) { // Add fieldset only if form has more than 1 element.
        $form['taxonomy'] += array(
          '#type' => 'fieldset',
          '#title' => t('Categories'),
          '#collapsible' => TRUE,
          '#collapsed' => FALSE,
        );
      }

Even though I withdrew all permissions from anonymous users, this (empty) fieldset still shows on node forms. See for example http://test.indymedia.be/en/publish/article.

douggreen’s picture

I think that the problem is with the weighting of the module. The default weighting in the system is alphabetical, meaning that "Taxonomy" occurs before "Vocabulary Permissions". Please run:

mysql> update system set weight = -9999 where name = 'vocabperms';

If that fixes it, then I'll add something like that to the module.

brunodbo’s picture

Running this query sets the weight for vocabperms in the system table to '-128' (the minimum weight?). When I look at an add-node form, all vocabularies that are associated with the node's node type are shown, vocab permissions are ignored it seems. Setting the weight value back to zero, brings back the previous situation.

douggreen’s picture

Status: Active » Fixed

I added the weighting the module, which will pretty much do exactly what I asked you to do by SQL. If you do download the latest version, you'll need to run update.php, which will update the module weight in the database.

brunodbo’s picture

Status: Active » Fixed

I think you may have misread my previous comment: when I install the module on my site now (fresh install on a new copy of my site), the vocabperms aren't taken into account (as mentioned above). When I change the module's weight in the system table to zero, they are. Please let me know if I'm doing something wrong - but I think your module may not be working correctly now (since vocabperms aren't taken into account). Thanks.

brunodbo’s picture

Status: Fixed » Active

Changing this back to active.

douggreen’s picture

Status: Fixed » Active

@brunedbo, this fell off my front page of problems, so I didn't realize it was marked back to active. While I was working on something else in vocabperms, I noticed that this was broken. It really should of been marked 'critical' in that the last change seriously broke the module. But I've now backed out the previous weighting, and hopefully it's back to working again. But that leaves your original problem. If you're still having it, can you explain it again. What version of php are you using? Thanks!

douggreen’s picture

Status: Active » Fixed

Ah, I finally get it. I'm removing the fieldset when there are two or more categories, but only one or fewer categories are editable. Please check out the latest version to test.

brunodbo’s picture

Works great, thanks!

(Sorry for not marking this issue as critical when the module broke; will do so in the future.)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.