function exponent_users_form($user = null) { $form = user::form($user); $form->unregister('submit'); // Pull in form data for all active profile extensions. // First, we have to clear delete extensions, so that we don't try to include // or use previously active extensions that have been disabled. exponent_users_clearDeletedExtensions(); // Include all class files for active profile extensions. exponent_users_includeProfileExtensions(); // Store the users full profile in a temporary object. $tmpu = exponent_users_getFullProfile($user); // Pull the database object in from the global scope. global $db; // Retrieve a list of the active profile extensions, and sort them by rank so that // the form controls get added to the form in order. $exts = $db->selectObjects('profileextension'); if (!defined('SYS_SORTING')) { include_once BASE . 'subsystems/sorting.php'; } usort($exts, 'exponent_sorting_byRankAscending'); foreach ($exts as $ext) { // Modify the form object by passing it through each profile extension, // each of which may or may not register new controls. $form = call_user_func(array($ext->extension, 'modifyForm'), $form, $tmpu); } // Add the submit button and return the complete form object to the caller. $i18n = exponent_lang_loadFile('subsystems/users.php'); $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel'])); return $form; }
exit(''); } if (exponent_permissions_check('user_management', exponent_core_makeLocation('AdministrationModule'))) { if (!defined('SYS_USERS')) { require_once BASE . 'subsystems/users.php'; } if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $u = exponent_users_getUserById(intval($_GET['id'])); if ($u == null) { $u->is_admin = 0; $u->is_acting_admin = 0; } $u = exponent_users_getFullProfile($u); $form = exponent_users_form($u); $form->meta('module', 'AdministrationModule'); $form->meta('action', 'umgr_saveuser'); if ($user->is_admin == 1 && $u->is_admin == 0) { // Super user editting a 'lesser' user. $i18n = exponent_lang_loadFile('modules/AdministrationModule/actions/umgr_editprofile.php'); $form->registerBefore('submit', 'is_acting_admin', $i18n['is_admin'], new checkboxcontrol($u->is_acting_admin, true)); } $template = new template('AdministrationModule', '_umgr_editprofile', $loc); $template->assign('form_html', $form->toHTML()); $template->assign('is_edit', isset($u->id) ? 1 : 0); $template->output(); } else { echo SITE_403_HTML; }