PDA

View Full Version : How to add a field in AdminCP User Manager


sv1cec
12-23-2013, 10:44 AM
Folks, I have a strange (perhaps) question.

In my old vB 3.0.xx site, I had changed the User Manager page in AdminCP to include some additional fields, which I used in my user table.

For example, I have a "donation" column in my user database table. In vB 3.0.xx I was able to edit that field from the User Manager page, in AdminCP and set it to whatever value I wanted.

I am trying to do the same thing in vB 4.2.2 and it seems that I can't do it. I have created the field in the User Manager page in AdminCP, and the value of the donation column for the user is read and shown properly but while I can enter a value there, that value is not saved in the user record, in the database.

It appears that the good old way, of editing the UPDATE query in user.php is now gone and things are done from the class_dm_user.php or some other program. I tried figuring how things are done in there, but without much success.

Here is a picture of the User Manager page. The field Donations is what I am trying to save in the database.

https://vborg.vbsupport.ru/external/2013/12/12.jpg

Can someone please help me out with this?

Thanks for all your help.

kh99
12-23-2013, 11:03 AM
Look at includes/class_dm_user.php. If you add your field to the $validfields array then I think it might solve your problem. You can make a plugin using hook userdata_start and do it there, or of course you could edit that file.

sv1cec
12-23-2013, 12:07 PM
God darn! I had tried that, but for some reason, I included the following line:


'donation' => array(TYPE_INT, REQ_NO, VF_METHOD),


instead of the proper:


'donation' => array(TYPE_INT, REQ_NO),


Thanks buddy, appreciated!