Skip to content

Commit

Permalink
NOBUG: Check that the user country is known
Browse files Browse the repository at this point in the history
This is to prevent PHP notice if the guest user is accessing a page with
the myprofile block instance. The notice appears even if the block is
hidden from guests.
  • Loading branch information
mudrd8mz committed Jun 28, 2010
1 parent b4e1f73 commit db9a141
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions blocks/myprofile/block_myprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ public function get_content() {

if(!isset($this->config->display_country) || $this->config->display_country == 1) {
$countries = get_string_manager()->get_list_of_countries();
$this->content->text .= '<div class="myprofileitem country">';
$this->content->text .= get_string('country') . ': ' . $countries[$user->country];
$this->content->text .= '</div>';
if (isset($countries[$user->country])) {
$this->content->text .= '<div class="myprofileitem country">';
$this->content->text .= get_string('country') . ': ' . $countries[$user->country];
$this->content->text .= '</div>';
}
}

if(!isset($this->config->display_city) || $this->config->display_city == 1) {
Expand Down

0 comments on commit db9a141

Please sign in to comment.