root/releases/0.6rc2/profile/index.php

Revision 332, 1.0 kB (checked in by carmartin, 3 years ago)

profile: fix edit link reinstating page ownership

Page ownership was indirectly being asserted in
profile_pagesetup(). This is now moved to the main
index.php .

Setup of stuff in the global space should happen from
within the global space, early in the game, and be
very visible. Function calls and code called from
run() should stick to reading from parameters, and
from certain declared globals ($CFG, $USER, etc).

  • Property svn:eol-style set to native
Line 
1 <?php
2
3 //    ELGG profile view page
4
5 // Run includes
6 require_once(dirname(dirname(__FILE__)) . '/includes.php');
7 require_once($CFG->dirroot . '/profile/profile.class.php');
8
9 // define what profile to show
10 $profile_name = optional_param('profile_name', '', PARAM_ALPHANUM);
11 if (!empty($profile_name)) {
12     $profile_id = run("users:name_to_id", $profile_name);
13 }
14 if (empty($profile_id)) {
15     $profile_id = optional_param('profile_id', -1, PARAM_INT);
16 }
17 // and the page_owner naturally
18 $page_owner = $profile_id;
19
20 define("context", "profile");
21 templates_page_setup();
22
23 // init library
24 $profile = new ElggProfile($profile_id);
25         
26 $title = $profile->display_name();
27 $body .= $profile->view();
28 $body  = templates_draw( array(
29                                'context' => 'contentholder',
30                                'title' => $title,
31                                'body' => $body
32                                ));
33
34 echo templates_page_draw(array($title, $body));
35
36 ?>
Note: See TracBrowser for help on using the browser.