Added user profile link helper

This commit is contained in:
aymm 2021-04-04 09:49:52 +02:00
parent a0b03d439f
commit 3604b1ae19
Signed by: phlaym
GPG Key ID: A06651BAB6777237

View File

@ -67,4 +67,16 @@ class User
} }
return $this->avatar_image->link.$query; return $this->avatar_image->link.$query;
} }
public function getProfileLink(?string $display_name = null): string
{
$display_name ??= $this->username;
return User::getProfileLinkForUsername($this->username, $display_name);
}
public static function getProfileLinkForUsername(string $username, ?string $display_name = null): string
{
$display_name ??= $username;
return '<a href="https://pnut.io/'.$username.'">'.$username.'</a>';
}
} }