pluginspath . "profile/actions/addcomment.php"); elgg_register_action("profile/deletecomment", $CONFIG->pluginspath . "profile/actions/deletecomment.php"); elgg_register_event_handler('profileupdate', 'all', 'object_notifications'); // allow ECML in parts of the profile elgg_register_plugin_hook_handler('get_views', 'ecml', 'profile_ecml_views_hook'); } /** * Profile page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism */ function profile_page_handler($page) { global $CONFIG; if (isset($page[0])) { $username = $page[0]; $user = get_user_by_username($username); elgg_set_page_owner_guid($user->guid); } // short circuit if invalid or banned username if (!$user || ($user->isBanned() && !isadminloggedin())) { register_error(elgg_echo('profile:notfound')); forward(); } $action = NULL; if (isset($page[1])) { $action = $page[1]; } if ($action == 'edit') { // use for the core profile edit page require $CONFIG->path . 'pages/profile/edit.php'; return; } // main profile page $params = array( 'box' => elgg_view('profile/box'), 'num_columns' => 3, ); $content = elgg_view_layout('widgets', $params); $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($title, $body); } /** * Returns the html for a user profile. * * @param string $username The username of the profile to display * @param string $section Which section is currently selected. * * @todo - This should really use a plugin hook to get the list of plugin tabs * * @return mixed FALSE or html for the profile. */ function profile_get_user_profile_html($user, $section = 'activity') { $body = elgg_view('profile/tab_navigation', array('section' => $section, 'entity' => $user)); $view_options = array('entity' => $user); $content = elgg_view("profile/tabs/$section", $view_options); $body .= elgg_view('profile/content_wrapper', array('content' => $content)); $body .= elgg_view('profile/sidebar', array('section' => $section)); return $body; } /** * Profile URL generator for $user->getUrl(); * * @param ElggUser $user * @return string User URL */ function profile_url($user) { return elgg_get_site_url() . "pg/profile/" . $user->username; } /** * Parse ECML on parts of the profile * * @param unknown_type $hook * @param unknown_type $entity_type * @param unknown_type $return_value * @param unknown_type $params */ function profile_ecml_views_hook($hook, $entity_type, $return_value, $params) { $return_value['profile/profile_content'] = elgg_echo('profile'); return $return_value; }