Modifying the User Profile Page and Edit Profile page to group/sort by my attribute sets

Permalink
I maintain a website for a flying club that I am a member of. I have added several user attributes and grouped them into two different sets:

Member Contact Info (member_contact_info)
Home Phone
Cell Phone
etc.


Memeber Pilot Information (member_pilot_information)
Birth Date
Medical Certificate
Pilot Certificate
etc.

A lot of the information in Member Pilot Information set is required by our insurance company.

When a user visits their own profile page, or edits their profile, all of the user attributes are listed in the order they were created and not grouped by the Sets they are associated with.

I have looked and looked and can't seem to find what I need to do. I've used Concrete5 for a while but have never really had to get under the hood very much. I've also used PHP for a while but have really only used the procedural style and never really got a grasp on the object oriented style.

I did copy the folling files to try to test a few things but to no avail...

concrete/single_pages/account/edit_profile.php -> application/single_pages/account/edit_profile.php
concrete/single_pages/membmer/profile.php -> application/single_pages/member/profile.php

For the profile.php, I'm pretty sure this is the seciton that needs to be changed:
--------------
<code>
<?php
$uaks = UserAttributeKey::getPublicProfileList();
foreach ($uaks as $ua) {
?>
<div>
<h4><?php echo $ua->getAttributeKeyDisplayName()?></h4>
<?php
$r = $profile->getAttribute($ua, 'displaySanitized', 'display');
if ($r) {
echo $r;
} else {
echo t('None');
}
?>
</div>
<?php
} ?>
</code>
--------------




and for the edit_profile.php, this is where it appears I need to make the changes.
---------------
<code>
<?php
if (is_array($attribs) && count($attribs)) {
foreach ($attribs as $ak) {
echo $profileFormRenderer
->buildView($ak)
->setIsRequired($ak->isAttributeKeyRequiredOnProfile())
->render();
}
}
?>
</code>
---------------



If anyone can help, I would greatly appreciate it! It would be even better is someone could provide some code samples.