Skip to content

Instantly share code, notes, and snippets.

@mudrd8mz
Created April 24, 2012 09:13
Show Gist options
  • Save mudrd8mz/2478155 to your computer and use it in GitHub Desktop.
Save mudrd8mz/2478155 to your computer and use it in GitHub Desktop.
diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index 918b693..3652010 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -340,13 +340,14 @@ class user_picture implements renderable {
// picture of not.
if (!empty($this->user->deleted) or !$context = context_user::instance($this->user->id, IGNORE_MISSING)) {
$hasuploadedfile = false;
+ } else if ($this->user->picture == 1) {
+ $hasuploadedfile = true;
} else {
- $fs = get_file_storage();
- $hasuploadedfile = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.jpg'));
+ $hasuploadedfile = false;
}
$imageurl = $renderer->pix_url('u/'.$filename);
- if ($hasuploadedfile && $this->user->picture == 1) {
+ if ($hasuploadedfile) {
$path = '/';
if (clean_param($page->theme->name, PARAM_THEME) == $page->theme->name) {
// We append the theme name to the file path if we have it so that
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment