Enrolment

 
 
Picture of Daniel Chuhta
Custom Registration Fields
 
How would I go about adding custom fields for my email-based self registration form? I've tried searching the forums, but I can't seem to find a straightforward response.

Thanks
 
Average of ratings: -
Picture of Deepak S
Re: Custom Registration Fields
 
Hey Daniel,

check out this link http://docs.moodle.org/en/User_profile_fields

u can create custom fields in registration form.......
 
Average of ratings: -
Picture of Daniel Chuhta
Re: Custom Registration Fields
 
Great! Now, where do those fields exits in the database, so that I can export them later? In which table do they live?

Thanks!
 
Average of ratings: -
books icon
Re: Custom Registration Fields
 
Hi,

Seems to be this stuff:
mysql> describe mdl_user_info_field;
+-------------+----------------------+------+-----+-----------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------------------+------+-----+-----------+----------------+
| id | bigint(10) unsigned | NO | PRI | NULL | auto_increment |
| shortname | varchar(255) | NO | | shortname | |
| name | longtext | NO | | NULL | |
| datatype | varchar(255) | NO | | | |
| description | longtext | YES | | NULL | |
| categoryid | bigint(10) unsigned | NO | | 0 | |
| sortorder | bigint(10) unsigned | NO | | 0 | |
| required | tinyint(2) unsigned | NO | | 0 | |
| locked | tinyint(2) unsigned | NO | | 0 | |
| visible | smallint(4) unsigned | NO | | 0 | |
| forceunique | tinyint(2) unsigned | NO | | 0 | |
| signup | tinyint(2) unsigned | NO | | 0 | |
| defaultdata | longtext | YES | | NULL | |
| param1 | longtext | YES | | NULL | |
| param2 | longtext | YES | | NULL | |
| param3 | longtext | YES | | NULL | |
| param4 | longtext | YES | | NULL | |
| param5 | longtext | YES | | NULL | |
+-------------+----------------------+------+-----+-----------+----------------+
18 rows in set (0.02 sec)

mysql> describe mdl_user_info_data;
+---------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------------------+------+-----+---------+----------------+
| id | bigint(10) unsigned | NO | PRI | NULL | auto_increment |
| userid | bigint(10) unsigned | NO | | 0 | |
| fieldid | bigint(10) unsigned | NO | | 0 | |
| data | longtext | NO | | NULL | |
+---------+---------------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)

Like this, from when we added a custom mail address line 1 field addr1:

mysql> select * from mdl_user_info_field limit 1;
+----+-----------+------------------+----------+------------------+------------+-----------+----------+--------+---------+-------------+--------+-------------+--------+--------+--------+--------+--------+
| id | shortname | name | datatype | description | categoryid | sortorder | required | locked | visible | forceunique | signup | defaultdata | param1 | param2 | param3 | param4 | param5 |
+----+-----------+------------------+----------+------------------+------------+-----------+----------+--------+---------+-------------+--------+-------------+--------+--------+--------+--------+--------+
| 2 | addr1 | Address Line One | text | Address Line One | 2 | 1 | 1 | 0 | 1 | 0 | 0 | | 30 | 50 | 0 | NULL | NULL |
+----+-----------+------------------+----------+------------------+------------+-----------+----------+--------+---------+-------------+--------+-------------+--------+--------+--------+--------+--------+
1 row in set (0.00 sec)

mysql> select * from mdl_user_info_data limit 1;
+----+--------+---------+--------------+
| id | userid | fieldid | data |
+----+--------+---------+--------------+
| 2 | 16 | 2 | 917 Mull Ave |
+----+--------+---------+--------------+
1 row in set (0.08 sec)

hth,
adric
 
Average of ratings: -
Picture of Daniel Chuhta
Re: Custom Registration Fields
 
perfect! Thank you!
 
Average of ratings: -
Picture of Sarfaraz Malik
Re: Custom Registration Fields
 

I wanted to use my custom profile creation page in which I am passing username/password and some other information. How I can store the encypted password. After profile creation I wanted to redirect the newly created user as a guest access.

 
Average of ratings: -