1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Add avatars to comments

This commit is contained in:
Starbeamrainbowlabs 2017-06-18 16:21:08 +01:00
parent cf866e92c5
commit 9c5f5d12a4
3 changed files with 7 additions and 6 deletions

View file

@ -2423,7 +2423,7 @@ function render_comments($comments_data, $depth = 0)
$comment = $comments_data[$i];
$result .= "\t<div class='comment' id='comment-$comment->id' data-comment-id='$comment->id'>\n";
$result .= "\t<p class='comment-header'><span class='name'>$comment->username</span> said:</p>";
$result .= "\t<p class='comment-header'><span class='name'>" . page_renderer::render_username($comment->username) . "</span> said:</p>";
$result .= "\t<div class='comment-body'>\n";
$result .= "\t\t" . parse_page_source($comment->message);
$result .= "\t</div>\n";
@ -4630,13 +4630,14 @@ register_module([
$requested_username = $_GET["user"];
// The user hasn't uploaded an avatar
if(empty($pageindex->{"Files/$requested_username/Avatar"}) || !$pageindex->{"Files/$requested_username/Avatar"}->uploadedfile) {
if(empty($pageindex->{"User/$requested_username/Avatar"}) || !$pageindex->{"User/$requested_username/Avatar"}->uploadedfile) {
$user_fragment = !empty($settings->users->$requested_username->emailAddress) ? $settings->users->$requested_username->emailAddress : $requested_username;
http_response_code(307);
header("x-reason: no-avatar-found");
header("x-hash-method: " . ($user_fragment === $requested_username ? "username" : "email_address"));
header("location: https://gravatar.com/avatar/" . md5($user_fragment) . "?default=identicon&rating=g&size=$size");
exit();
}
// The user has uploaded an avatar, so we can redirec to the regular previewer :D

View file

@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds threaded comments to the bottom of every page.",
"id": "feature-comments",
"lastupdate": 1497797558,
"lastupdate": 1497798675,
"optional": false
},
{
@ -113,7 +113,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds a user preferences page, letting pople do things like change their email address and password.",
"id": "feature-user-preferences",
"lastupdate": 1497797564,
"lastupdate": 1497798274,
"optional": false
},
{

View file

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Page Comments",
"version" => "0.2.1",
"version" => "0.2.2",
"author" => "Starbeamrainbowlabs",
"description" => "Adds threaded comments to the bottom of every page.",
"id" => "feature-comments",
@ -314,7 +314,7 @@ function render_comments($comments_data, $depth = 0)
$comment = $comments_data[$i];
$result .= "\t<div class='comment' id='comment-$comment->id' data-comment-id='$comment->id'>\n";
$result .= "\t<p class='comment-header'><span class='name'>$comment->username</span> said:</p>";
$result .= "\t<p class='comment-header'><span class='name'>" . page_renderer::render_username($comment->username) . "</span> said:</p>";
$result .= "\t<div class='comment-body'>\n";
$result .= "\t\t" . parse_page_source($comment->message);
$result .= "\t</div>\n";