'Categories' fieldset shown when user has no vocabulary permission at all

brunodbo - October 2, 2007 - 20:19
Project:Vocabulary Permissions
Version:5.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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?

#1

douggreen - October 15, 2007 - 11:33

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.

#2

brunodbo - October 24, 2007 - 13:28

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.

#3

douggreen - October 24, 2007 - 16:05

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.

#4

brunodbo - October 24, 2007 - 21:37

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.

#5

douggreen - November 1, 2007 - 16:48
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.

#6

brunodbo - November 15, 2007 - 11:59

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.

#7

brunodbo - November 15, 2007 - 10:45
Status:fixed» active

Changing this back to active.

#8

douggreen - January 13, 2008 - 20:27

@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!

#9

douggreen - January 14, 2008 - 11:32
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.

#10

brunodbo - January 17, 2008 - 11:42

Works great, thanks!

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

#11

Anonymous (not verified) - January 31, 2008 - 11:51
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.