diff --git a/core/user.php b/core/user.php index 48394723..73722add 100644 --- a/core/user.php +++ b/core/user.php @@ -213,6 +213,16 @@ class User * a local file, a remote file, a gravatar, a something else, etc. */ public function get_avatar_html(): string + { + $url = $this->get_avatar_url(); + if (!empty($url)) { + return "avatar"; + } + return ""; + } + + #[Field(name: "avatar_url")] + public function get_avatar_url(): ?string { // FIXME: configurable global $config; @@ -223,10 +233,10 @@ class User $d = urlencode($config->get_string("avatar_gravatar_default")); $r = $config->get_string("avatar_gravatar_rating"); $cb = date("Y-m-d"); - return "avatar"; + return "https://www.gravatar.com/avatar/$hash.jpg?s=$s&d=$d&r=$r&cacheBreak=$cb"; } } - return ""; + return null; } /**