Download & Extend

Module settings appear more than once

Project:Preferred Format
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

The settings page of the module appears once for every tab present in the user edit page.
That is because the function preferred_format_user() miss an argument which is passed from Drupal 6.
The exact declaration of the hook is the following:

<?php
  hook_user
($op, &$edit, &$account, $category = NULL)
?>

where $category is a category which has been declared by the module in the same hook, or it's an existing one (i.e. it could be "account", which is the first tab presented when editing an user account.
In the second case, the code should be something like:

<?php
 
if ($op == 'form' && $category == 'account') {
   
// Create the form field you want to add to the page.
    // ...
   
return $form;
  }
?>

It would be preferable to use a different category, so the user could know it can set his preferred filter format without to look at the end of a long page. In this case, the user could notice he has something more he can set.

Comments

#1

Status:active» needs review

I made a patch to resolve the issue.

AttachmentSize
preferred_format_categories_78120.patch 7.2 KB

#2

I misunderstood on "linear array of associative arrays"(hook_user). It seems the format of the array must be something like

<?php
array(
 
'preferred_format' => array(
   
'name'   => 'preferred_format',
   
'title'  => t('Preferred filter format'),
   
'weight' => 5,
  )
)
?>

The new patch changes that.

AttachmentSize
preferred_format_categories_78148.patch 7.55 KB

#3

Whoops. The patch also changes the name of the permission used by the module, which includes an useless "can" (see #284885: Change the name of the permission).

#4

  • Fixed the form which was appearing empty for users without permission to change the default filter format;
  • removed the permission;
  • cleaned up the code a little.
AttachmentSize
preferred_format_categories_78163.patch 7.58 KB

#5

Subscribing -- so, this is a known serious problem, there's a known fix for over 6 months, and it's not applied? I'll check out the above patch and see if I like it. Is the module maintainer present?

#6

The last time a new code revision for the Drupal 6 branch has been submitted was less than a month ago.

If you want to look to an alternative, you can look at Better Formats.

nobody click here