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:

  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:

  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

avpaderno’s picture

Status: Active » Needs review
StatusFileSize
new7.2 KB

I made a patch to resolve the issue.

avpaderno’s picture

StatusFileSize
new7.55 KB

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

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

The new patch changes that.

avpaderno’s picture

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).

avpaderno’s picture

StatusFileSize
new7.58 KB
  • 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.
reikiman’s picture

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?

avpaderno’s picture

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.

  • Commit 3f42218 on master by gdevlugt:
    #284884: Fixes settings form displaying on all user edit tabs.
    
gdevlugt’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

A very, very belated fix for this issue, available in the latest 6.x-1.x-dev version.

Many thanks to kiamlaluno for the patch which introduces a separate user edit category tab for this module. However, I decided not to include it because this (small) form belongs to the account tab. Also, too many tabs might break up some themes and may clutter the tab menu options.