1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Link usernames in recent changesto their respective user pages

This commit is contained in:
Starbeamrainbowlabs 2017-02-12 09:55:37 +00:00
parent 6b2cdc354a
commit 33b39f46d3
4 changed files with 11 additions and 7 deletions

View file

@ -874,7 +874,7 @@ function render_pagename($rchange)
return $pageDisplayName; return $pageDisplayName;
} }
/** /**
* Renders an editor's name in HTML. * Renders an editor's or a group of editors name(s) in HTML.
* @param string $editorName The name of the editor to render. * @param string $editorName The name of the editor to render.
* @return string HTML representing the given editor's name. * @return string HTML representing the given editor's name.
*/ */
@ -1448,7 +1448,7 @@ class page_renderer
$result = ""; $result = "";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
$result .= $name; $result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>$name</a>";
return $result; return $result;
} }
@ -2411,6 +2411,8 @@ function render_recent_changes($recent_changes)
if(!in_array($recent_changes[$key]->user, $users)) if(!in_array($recent_changes[$key]->user, $users))
$users[] = $recent_changes[$key]->user; $users[] = $recent_changes[$key]->user;
} }
foreach($users as &$user)
$user = page_renderer::render_username($user);
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
$next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
@ -2433,7 +2435,7 @@ function render_recent_change($rchange)
{ {
global $pageindex; global $pageindex;
$pageDisplayHtml = render_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_editor($rchange->user); $editorDisplayHtml = render_editor(page_renderer::render_username($rchange->user));
$timeDisplayHtml = render_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$revisionId = false; $revisionId = false;

View file

@ -555,7 +555,7 @@ function render_pagename($rchange)
return $pageDisplayName; return $pageDisplayName;
} }
/** /**
* Renders an editor's name in HTML. * Renders an editor's or a group of editors name(s) in HTML.
* @param string $editorName The name of the editor to render. * @param string $editorName The name of the editor to render.
* @return string HTML representing the given editor's name. * @return string HTML representing the given editor's name.
*/ */
@ -1129,7 +1129,7 @@ class page_renderer
$result = ""; $result = "";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
$result .= $name; $result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>$name</a>";
return $result; return $result;
} }

View file

@ -68,7 +68,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.", "description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes", "id": "feature-recent-changes",
"lastupdate": 1482008539, "lastupdate": 1486893286,
"optional": false "optional": false
}, },
{ {

View file

@ -172,6 +172,8 @@ function render_recent_changes($recent_changes)
if(!in_array($recent_changes[$key]->user, $users)) if(!in_array($recent_changes[$key]->user, $users))
$users[] = $recent_changes[$key]->user; $users[] = $recent_changes[$key]->user;
} }
foreach($users as &$user)
$user = page_renderer::render_username($user);
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
$next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary><a href='?page=" . rawurlencode($rchange_first->page) . "'>$pageDisplayHtml</a> $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
@ -194,7 +196,7 @@ function render_recent_change($rchange)
{ {
global $pageindex; global $pageindex;
$pageDisplayHtml = render_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_editor($rchange->user); $editorDisplayHtml = render_editor(page_renderer::render_username($rchange->user));
$timeDisplayHtml = render_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$revisionId = false; $revisionId = false;