diff --git a/ext/user/main.php b/ext/user/main.php index ac914b08..075107f7 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -67,7 +67,14 @@ class UserPage extends Extension { } else { // view $duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0)); - send_event(new UserPageBuildingEvent($event->page, $duser)); + if(!is_null($duser)) { + send_event(new UserPageBuildingEvent($event->page, $duser)); + } + else { + $this->theme->display_error($page, "No Such User", + "If you typed the ID by hand, try again; if you came from a link on this ". + "site, it might be bug report time..."); + } } } diff --git a/ext/user/theme.php b/ext/user/theme.php index 252aa46f..84be2c1a 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -75,25 +75,18 @@ class UserPageTheme extends Themelet { } public function display_user_page($page, $duser, $user) { - if(!is_null($duser)) { - $page->set_title("{$duser->name}'s Page"); - $page->set_heading("{$duser->name}'s Page"); - $page->add_block(new NavBlock()); - $page->add_block(new Block("Stats", $this->build_stats($duser))); + $page->set_title("{$duser->name}'s Page"); + $page->set_heading("{$duser->name}'s Page"); + $page->add_block(new NavBlock()); + $page->add_block(new Block("Stats", $this->build_stats($duser))); - if(!$user->is_anonymous()) { - if($user->id == $duser->id || $user->is_admin()) { - $page->add_block(new Block("Options", $this->build_options($duser), "main", 0)); - } - if($user->is_admin()) { - $page->add_block(new Block("More Options", $this->build_more_options($duser))); - } + if(!$user->is_anonymous()) { + if($user->id == $duser->id || $user->is_admin()) { + $page->add_block(new Block("Options", $this->build_options($duser), "main", 0)); + } + if($user->is_admin()) { + $page->add_block(new Block("More Options", $this->build_more_options($duser))); } - } - else { - $this->display_error($page, "No Such User", - "If you typed the ID by hand, try again; if you came from a link on this ". - "site, it might be bug report time..."); } }