Add custom fields to Children registration
- Paolo
- Topic Author
- Offline
- Junior Member
-
Less
More
13 years 10 months ago - 13 years 10 months ago #1
by Paolo
Add custom fields to Children registration was created by Paolo
Hi, I was trying to understand how to add custom fields to the children registration.
If I understood it is an extension of Jview so I just would need to add the fields I need in my database _users table, then the fields in the form in com_joomdle/views/register and what I don't understand is where to add the variables to tell the form about the database
Thanks for replies
Paolo
If I understood it is an extension of Jview so I just would need to add the fields I need in my database _users table, then the fields in the form in com_joomdle/views/register and what I don't understand is where to add the variables to tell the form about the database
Thanks for replies
Paolo
Last edit: 13 years 10 months ago by Paolo.
Please Log in or Create an account to join the conversation.
- Paolo
- Topic Author
- Offline
- Junior Member
-
13 years 10 months ago #2
by Paolo
Replied by Paolo on topic Re: Add custom fields to Children registration
For the ones who need this, I almost got to the solution:
1) edit \joomla\components\com_joomdle\views\register\tmpl\default.php inserting the fields you need ,for example
2) add the fields in the database in ****_users table with phpmyadmin obviously same name (example "codfiscale")
3) edit \joomla\libraries\joomla\database\table\user.php adding this string "var $codfiscale = null;" under
"class JTableUser extends JTable
{"
for each field you created.
Now you capture addictional datas and get stored in the database but I still have to map those to moodle
1) edit \joomla\components\com_joomdle\views\register\tmpl\default.php inserting the fields you need ,for example
Warning: Spoiler!
<tr>
<td width="30%" height="40">
<label id="codfiscalemsg" for="codfiscale">
<?php echo JText::_( 'Codice Fiscale' ); ?>:
</label>
</td>
<td>
<input type="text" name="codfiscale" id="codfiscale" size="40" value="<?php echo $this->escape($this->user->get( 'codfiscale' ));?>" class="inputbox required" maxlength="16" /> *
</td>
</tr>
<td width="30%" height="40">
<label id="codfiscalemsg" for="codfiscale">
<?php echo JText::_( 'Codice Fiscale' ); ?>:
</label>
</td>
<td>
<input type="text" name="codfiscale" id="codfiscale" size="40" value="<?php echo $this->escape($this->user->get( 'codfiscale' ));?>" class="inputbox required" maxlength="16" /> *
</td>
</tr>
2) add the fields in the database in ****_users table with phpmyadmin obviously same name (example "codfiscale")
3) edit \joomla\libraries\joomla\database\table\user.php adding this string "var $codfiscale = null;" under
"class JTableUser extends JTable
{"
for each field you created.
Now you capture addictional datas and get stored in the database but I still have to map those to moodle
Please Log in or Create an account to join the conversation.
- Paolo
- Topic Author
- Offline
- Junior Member
-
13 years 10 months ago #3
by Paolo
Replied by Paolo on topic Re: Add custom fields to Children registration
It doesn't look that simple acutally to map those fields, anyone know where does Joomdle query the db to get the fields from Joomla registration? Someone able with sql can help?
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
13 years 10 months ago #4
by Antonio Durán
Replied by Antonio Durán on topic Re: Add custom fields to Children registration
Hi Paolo.
I guess you are working on J2.5, right? Maybe it is easier to use the user_profiles table, instead of hacking the users table. This way you don't need to alter Joomla DB schema.
Also, it should be easier, as Joomdle can already handle that kind of mappings.
In fact, I think the way to go would be to re-create register view in Joomdle, based on the new J2.5 view, so that it works with the profile plugins.
I guess you are working on J2.5, right? Maybe it is easier to use the user_profiles table, instead of hacking the users table. This way you don't need to alter Joomla DB schema.
Also, it should be easier, as Joomdle can already handle that kind of mappings.
In fact, I think the way to go would be to re-create register view in Joomdle, based on the new J2.5 view, so that it works with the profile plugins.
Please Log in or Create an account to join the conversation.
- Paolo
- Topic Author
- Offline
- Junior Member
-
13 years 10 months ago #5
by Paolo
Replied by Paolo on topic Re: Add custom fields to Children registration
Thank you for the advice, I'm going to try this way right now, but I'm starting to think it will be harder then I thought!
Please Log in or Create an account to join the conversation.