public function __construct()
 {
     gateKeeper();
     $message = NULL;
     $user = getLoggedInUser();
     $user->profile_complete = true;
     $profile_type = $user->profile_type;
     $fields = ProfileField::get($profile_type);
     foreach ($fields as $key => $field) {
         if ($field['required'] == "true" && !getInput($key)) {
             $message .= "{$field['label']} cannot be empty.";
         }
     }
     if ($message) {
         new SystemMessage($message);
         forward("editProfile");
     }
     foreach ($fields as $key => $field) {
         $user->{$key} = getInput($key);
     }
     $user->save();
     new Activity($user->guid, "activity:profile:updated", array($user->getURL(), $user->full_name));
     new SystemMessage("Your profile has been updated.");
     forward("profile/{$user->guid}");
 }
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$user = getLoggedInUser();
$user_type = isset($user->profile_type) ? $user->profile_type : "default";
$fields = ProfileField::get($user_type);
if ($fields) {
    foreach ($fields as $key => $field) {
        $fieldname = $key;
        $value = isset($user->{$fieldname}) ? $user->{$fieldname} : "";
        if ($value && $field['field_type'] == "date") {
            $value = date("m/d/Y", $value);
        }
        $options = isset($field['options']) ? $field['options'] : "";
        $class = isset($field['class']) ? $field['class'] : "form-control";
        echo display("input/" . $field['field_type'], array("name" => $key, "value" => $value, "label" => $field['label'], "options_values" => $options, "class" => $class));
    }
}
echo display('input/submit', array('label' => 'Save', "class" => "btn btn-success", "cancel" => true));
        if (loggedIn()) {
            $guid = getLoggedInUserGuid();
            $owner = getLoggedInUser();
        }
    }
}
$url = getSiteURL();
$profile_info_editor = NULL;
$profile_info = NULL;
$truncate = NULL;
$profile_type = $owner->profile_type;
if (!$profile_type) {
    $profile_type = "default";
}
$avatar = $owner->icon(LARGE);
$profile_fields = ProfileField::get($profile_type);
$status = $owner->status ? "<div class='well well-sm'>{$owner->status}</div>" : "";
foreach ($profile_fields as $name => $values) {
    $field_type = $values['field_type'];
    $footer = NULL;
    $label = $values['label'];
    $value = $owner->{$name};
    if ($value) {
        if ($values['field_type'] != "textarea" && $values['field_type'] != 'editor' && $values['field_type'] != 'hidden') {
            $value_text = display("output/{$field_type}", array("value" => $value, "label" => $label));
            $profile_info .= <<<HTML
            <tr>
                <td>{$value_text}</td>
            </tr>
HTML;
        } elseif ($values['field_type'] != "hidden") {