1

What is the correct MySQL database datatype to be able to store the form data of the Joomla Standard Form Field usergrouplist?

Since Joomla 3.2 usergrouplist should be used instead of usergroup. As there is no documentation for usergrouplist so far I am wondering what's the correct CREATE TABLE statement to be able to store the form data in the database.

Serializing the form data and saving it to a text file shows that the form data is an array:

'usergrouplist_form_data' => 
  array (
    0 => '1',
    1 => '11',
  ),

An overview of all Joomla standard form field types can be found here.

2

The usergrouplist is just a list of user group IDs in Joomla.

If you're going to save a single user group ID then any INT type (e.g. SMALLINT) should be fine.

However you can use this field (as any other list type) also with the option multiple=true. Then you have different options, for example set your column type to a TEXT type and save all values as JSON string or comma-separated list into it. Or you could use a third table with INT types again which would store the mappings of user group IDs to your data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.