if (isset($_SESSION['profile:preload'])) { $data['profile:preload'] = $_SESSION['profile:preload']; unset($_SESSION['profile:preload']); } if (isset($_SESSION['profile:preload:access'])) { $data['profile:preload:access'] = $_SESSION['profile:preload:access']; unset($_SESSION['profile:preload:access']); } $title = user_name($page_owner) . " :: " . __gettext("Edit profile") . ""; templates_page_setup(); $metatags .= "<script type=\"text/javascript\" src=\"" . $CFG->wwwroot . "mod/profile/tabber/tabber.js\"></script>"; $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/profile/tabber/example.css\" type=\"text/css\" media=\"screen\" />"; if ($profile_new = data_submitted()) { $body = profile_update($profile_new); } else { $body = $profile->display_form(); } templates_page_output($title, $body); function profile_update($profile_new) { global $CFG; global $data; global $messages; global $page_owner; global $profile_name; $profiledetails = optional_param('profiledetails', array()); if (count($profiledetails) > 0) { // delete_records('profile_data','owner',$page_owner); $insertvalues = array(); $requiredmissing = array(); foreach ($profiledetails as $field => $value) {
if ($profile_id === -1 && isset($_SESSION['userid'])) { $profile_id = $_SESSION['userid']; } $profile_name = run("users:id_to_name", $profile_id); } // init library $profile = new ElggProfile($profile_id); define("context", "profile"); protect(1); global $page_owner; $title = run("users:display:name", $page_owner) . " :: " . gettext("Edit profile") . ""; templates_page_setup(); if ($profile_new = data_submitted()) { $body = profile_update($profile_new); } else { $body = $profile->display_form() . (include $CFG->dirroot . "units/tinymce/tinymce_js.php"); } $body = templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body)); print templates_page_draw(array($title, $body)); function profile_update($profile_new) { global $CFG; global $data; global $messages; global $page_owner; global $profile_name; $profiledetails = optional_param('profiledetails', array()); if (count($profiledetails) > 0) { delete_records('profile_data', 'owner', $page_owner); foreach ($profiledetails as $field => $value) { $field = trim($field);