Project

General

Profile

Actions

Bug #37195

closed

Custom User Settings on be_uesers only work if type=>'text'

Added by Christoph Buchli over 12 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2012-05-15
Due date:
% Done:

30%

Estimated time:
10.00 h
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Suppose you want to have a Checkbox in User-Settings where the User can configure something. This Setting, you want to simply be stored in a custom field on the be_user table.
your ext_tables.php might look something like this:

if(t3lib_extMgm::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS'])) {
        $GLOBALS['TYPO3_USER_SETTINGS']['columns'] = array_merge(
                $GLOBALS['TYPO3_USER_SETTINGS']['columns'],
                array(
                        'tx_myExtension_allowSomething' => array (
                                'type' => 'check',
                                'label' => 'LLL:EXT:myExtension/locallang_db.xml:be_users.tx_myExtension_allowSomething',
                                'table' => 'be_users',
                        ),
                )
        );

(Same problem goes with "select"-Fields.)

The Field is displayed properly but you can't set anything there, since TYPO3 won't store it to the DB.

The Problem is that while rendering the form the "table"-Setting is ignored.
Means: If you set the field to "text", the field is rendered the following:

<input id="field_tx_myExtension_someText" type="text" name="data*[be_users]*[tx_myExtension_someText]" value="text" style="width:192px;">

This works perfectly.

But if it's "check" or "select" it's:

<input id="field_tx_myExtension_allowSomething" type="checkbox" name="data[tx_myExtension_allowSomething]" class="check">

Solution
The attached .diff adds the configured table-name to the name of the input-field while rendering.
Like this, TYPO3 is able to store the value in the be_users table.


Files

beUsersTable.diff (1.26 KB) beUsersTable.diff Christoph Buchli, 2012-05-15 17:33
Actions

Also available in: Atom PDF