Add a "profile_field_Class" in the list of students

Re: Add a "profile_field_Class" in the list of students

by Barry Oosthuizen -
Number of replies: 0
Hi F S,

Try doing this in the attendances.php file:

  • Add another header the same way you added one for 'Class'.

Then find this code in the attendances.php file:

  • $table->data[$student->id][] = profile_display_fields($student->id);

And change it to:

$profilefields = get_records_select('user_info_data', 'userid='.$student->id, '', 'data');

foreach($profilefields as $field) {

$table->data[$student->id][] = $field->data;}


This solution will add a data in a column for each custom profile field you have. If you have more than the 2 custom fields and you only want to use two specific ones you'll need to go about it a bit differently:

Something like:

// this is for the first profile field. Change '1' to whatever datafield id corresponds to the field you want to use

$profilefield1 = get_records_select('user_info_data', 'userid='.$student->id." AND fieldid='1'", '', 'data');

foreach($profilefield1 as $field) {

$table->data[$student->id][] = $field->data;}

// this is for the first profile field. Change '2' to whatever fieldid corresponds to the field you want to use

$profilefield2 = get_records_select('user_info_data', 'userid='.$student->id." AND fieldid='2'", '', 'data');

foreach($profilefield2 as $field) {

$table->data[$student->id][] = $field->data;}


I haven't tested the second solution so if you need to use it just let me know if it gives you any problems.