[development] Let's kill $user->data

Peter Wolanin pwolanin at gmail.com
Wed Nov 22 15:28:42 UTC 2006

Having supplied this patch http://drupal.org/node/79804 (needs a 4.7
backport) - I agree that $user->data is mostly a headache.  However,
as Chris says, there could be effective ways to use this column.

My suggestion would be establish a mechanism for cleanly separating in
the user add/edit form those form values that should get saved into
the data field.  That way, form values don't have to be carefully
unset() to avoid having them saved into the data column.

For example, set up a form element in the default form like:

$form['data'] = array('#tree' => TRUE);

And then modules could form_alter this and add items like;

$form['data']['mymodule'] = array(
  '#type' => 'checkbox',
  '#title' => 'Should this be set?',

So only form values under 'data' would get saved into the data column.

Date: Wed, 22 Nov 2006 09:58:07 +0100
From: "Karoly Negyesi" <karoly at negyesi.net>
Subject: [development] Let's kill $user->data
To: devel <development at drupal.org>
Message-ID: <op.tjetu5dvq2e0ri at bean>
Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8


Two steps

a) We remove $user->data handling code from D6 core. No save, no load. New
installs won't have this column.
b) D7 will drop the $user->data if it exists. (SELECT * FROM user,
$account = db_fetch_array, if(isset($account['data'])) -- no need for DDL
to check for a column).

This way D6 contribs can clean up $user->data and migrate to their own



More information about the development mailing list