Hello.
I managed to add a new custom field to a user called "Poste".
Here's what I did :
1 - Opened the "auth/user.php" file, and under the "KUser" class, I have added a new variable named "$poste", being equal to ''. So it looks like this :
2 - In that same file, I went to the "populate_fields" function at line 94, then added a line in the "$fields" array, so it looks like this:
3 - Went to line 108, in that "foreach( $fields as $k=>$v )" loop, and at around line 130, I have added a condition for the "poste" variable/field. It looks like this:
4 - Went to line 283, in the "if( $this->id == -1 )" condition, and added my "poste" variable there too, inside the array at line 284:
5 - Then, I went in phpMyAdmin, in the "couch_users" table, clicked on the "Structure" tab, and added 1 column named "poste", with a type of "varchar(255)", collation of "utf8_general_ci, null of "yes", default of "NULL". It looks like this:

6 - When that was done, a "k_poste" field was added to the Users edit page, and I was able to enter whatever I want, click save to save it, and display this information anywhere on the site.
My issue, is that I cannot edit passwords for a user, or create new users and saving the password now.
When I fill the form to create a new user, I will receive the success message, but when I try to log in using the username and password, it doesn't work. I had some trouble at first when doing this, and I think that what it does is that there is a mis-alignment with the fields in Couch, and the database table. Not sure though.
Anyone knows what is causing my issue? Maybe I forgot to add something, or I entered the wrong data somewhere.
I was pretty proud of being able to add that field to each users, since I'm not a PHP coder. But now I need some help.
Thanks a lot!
I managed to add a new custom field to a user called "Poste".
Here's what I did :
1 - Opened the "auth/user.php" file, and under the "KUser" class, I have added a new variable named "$poste", being equal to ''. So it looks like this :
- Code: Select all
class KUser{
var $id = -1;
var $name = '';
var $title = '';
var $password = '';
var $email = '';
var $poste = '';
...
2 - In that same file, I went to the "populate_fields" function at line 94, then added a line in the "$fields" array, so it looks like this:
- Code: Select all
$fields = array(
'name'=>$FUNCS->t('user_name'),
'title'=>$FUNCS->t('display_name'),
'email'=>$FUNCS->t('email'),
'poste'=>$FUNCS->t('poste'),
'access_level'=>$FUNCS->t('role'),
'disabled'=>$FUNCS->t('disabled')
);
3 - Went to line 108, in that "foreach( $fields as $k=>$v )" loop, and at around line 130, I have added a condition for the "poste" variable/field. It looks like this:
- Code: Select all
if( $k=='name' ){
$field_info['k_desc'] = $FUNCS->t('user_name_restrictions');
$field_info['validator'] = 'title_ready|min_len=4|max_len=255';
}
elseif( $k=='email' ){
$field_info['validator'] = 'email';
}
elseif( $k=='poste' ){
$field_info['validator'] = 'min_len=1|max_len=10';
}
...
4 - Went to line 283, in the "if( $this->id == -1 )" condition, and added my "poste" variable there too, inside the array at line 284:
- Code: Select all
$rs = $DB->insert( K_TBL_USERS, array(
'name'=>$name,
'password'=>$hash,
'registration_date'=>$FUNCS->get_current_desktop_time(),
'email'=>$email
'poste'=>$poste
)
...
5 - Then, I went in phpMyAdmin, in the "couch_users" table, clicked on the "Structure" tab, and added 1 column named "poste", with a type of "varchar(255)", collation of "utf8_general_ci, null of "yes", default of "NULL". It looks like this:

6 - When that was done, a "k_poste" field was added to the Users edit page, and I was able to enter whatever I want, click save to save it, and display this information anywhere on the site.
My issue, is that I cannot edit passwords for a user, or create new users and saving the password now.
When I fill the form to create a new user, I will receive the success message, but when I try to log in using the username and password, it doesn't work. I had some trouble at first when doing this, and I think that what it does is that there is a mis-alignment with the fields in Couch, and the database table. Not sure though.
Anyone knows what is causing my issue? Maybe I forgot to add something, or I entered the wrong data somewhere.
I was pretty proud of being able to add that field to each users, since I'm not a PHP coder. But now I need some help.
Thanks a lot!