Log in

View Full Version : Increment fields in user table


PitchouneN64ngc
05-29-2006, 07:55 PM
Hi there :)

I want to increment a new field in my user table. I've made some code for this.

In the 'forumadmin_edit_form' plugin, I've made this code:

print_yes_no_row($vbphrase['allow_count_field1'], 'forum[countfields1]', $forum['countfields1']);
In the 'forumdata_start' plugin, I've made this code:

$this->validfields['countfields1'] = array(TYPE_UNINT, REQ_NO);
All the previous code works (the field 'countfields1' is created in the forum table and the field 'fields1' is created in the user table).

And, for apply this previous code and increment, I've made this code in the 'postdata_postsave' plugin:

if ($this->info['user'])
{
$user =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
$user->set_existing($this->info['user']);

if ($this->info['forum']['countfields1'])
{
$user->set('fields1', 'fields1 + 1', false);
}

$user->save();
}
This code won't work. I don't know what I missing for this code works.

If anyone have a suggestion, I'll take ;)

Thank you :)