Commit 49155053 authored by Kjartan's avatar Kjartan

common.inc

- format_username() now takes a second optional parameter which gives the
  real name of the user.

Rest
- updated the calls to format_username() where appropriate to show the name
  of the user instead of the account id. Clicking on a name will still give you
  the account info etc. If you find a place where the real name is not shown
  let me know.
parent d016fb14
......@@ -204,8 +204,8 @@ function format_date($timestamp, $type = "medium", $format = "") {
return $date;
}
function format_username($username) {
if ($username) return (user_access("administer users") ? "<A HREF=\"admin.php?mod=account&op=view&name=". urlencode($username) ."\">$username</A>" : "<A HREF=\"account.php?op=view&name=". urlencode($username) ."\">$username</A>");
function format_username($username, $realname="") {
if ($username) return (user_access("administer users") ? "<A HREF=\"admin.php?mod=account&op=view&name=". urlencode($username) ."\">". check_output($realname ? $realname : $username) ."</A>" : "<A HREF=\"account.php?op=view&name=". urlencode($username) ."\">". check_output($realname ? $realname : $username) ."</A>");
else return variable_get(anonymous, "Anonymous");
}
......
......@@ -61,7 +61,7 @@ function book_view($node, $main = 0) {
$output .= " <TR><TD COLSPAN=\"2\">$location</TD><TD ALIGN=\"right\">". node_control($node) ."</TD></TR>\n";
$output .= " <TR><TD COLSPAN=\"3\"><HR></TD></TR>";
$output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_username($node->userid) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n";
$output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_username($node->userid, $node->name) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n";
}
if ($node->body) {
......
......@@ -61,7 +61,7 @@ function book_view($node, $main = 0) {
$output .= " <TR><TD COLSPAN=\"2\">$location</TD><TD ALIGN=\"right\">". node_control($node) ."</TD></TR>\n";
$output .= " <TR><TD COLSPAN=\"3\"><HR></TD></TR>";
$output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_username($node->userid) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n";
$output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_username($node->userid, $node->name) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n";
}
if ($node->body) {
......
......@@ -64,13 +64,13 @@ function queue_vote($id, $vote) {
function queue_overview() {
global $status, $theme, $user;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'");
$result = db_query("SELECT n.*, u.userid, u.name FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'");
$content .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$content .= " <TR><TH>". t("Subject") ."</TH><TH>". t("Author") ."</TH><TH>". t("Type") ."</TH><TH>". t("Score") ."</TH></TR>\n";
while ($node = db_fetch_object($result)) {
if ($user->id == $node->author || field_get($node->users, $user->userid)) $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". queue_score($node->nid) ."</TD></TR>\n";
else $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\"><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". t("vote") ."</A></TD></TR>\n";
if ($user->id == $node->author || field_get($node->users, $user->userid)) $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid, $node->name) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". queue_score($node->nid) ."</TD></TR>\n";
else $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid, $node->name) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\"><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". t("vote") ."</A></TD></TR>\n";
}
$content .= "</TABLE>\n";
......
......@@ -63,7 +63,7 @@ function node($node, $main = 0) {
<TD>
<?php
echo strtr(t("by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "small")));
echo strtr(t("by %a on %b"), array("%a" => format_username($node->userid, $node->name), "%b" => format_date($node->timestamp, "small")));
?>
</TD>
......@@ -120,7 +120,7 @@ function comment($comment, $link = "") {
echo t("Author") .":";
echo " </TD>";
echo " <TD COLSPAN=\"2\">";
echo format_username($comment->userid) ." on ". format_date($comment->timestamp);
echo format_username($comment->userid, $comment->name) ." on ". format_date($comment->timestamp);
echo " </TD>";
echo " </TR>";
......
......@@ -55,7 +55,7 @@ function node($node, $main = 0) {
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">\n";
print " <tr><td colspan=\"2\"><img src=\"themes/marvin/images/drop.gif\" alt=\"\" /> &nbsp; <b>". check_output($node->title) ."</b></td></tr>\n";
print " <tr valign=\"bottom\"><td colspan=\"2\" bgcolor=\"#000000\" width=\"100%\"><img src=\"themes/marvin/images/pixel.gif\" width=\"1\" height=\"0\" alt=\"\" /></td></tr>\n";
print " <tr><td><font color=\"#7C7C7C\"><small>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))); ?><?php print "</small></font></td><td align=\"right\" valign=\"top\" nowrap><small>". node_index($node) ."</small></td></tr>\n";
print " <tr><td><font color=\"#7C7C7C\"><small>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid, $node->name), "%b" => format_date($node->timestamp, "large"))); ?><?php print "</small></font></td><td align=\"right\" valign=\"top\" nowrap><small>". node_index($node) ."</small></td></tr>\n";
print " <tr><td colspan=\"2\">&nbsp;</td></tr>\n";
print " <tr><td colspan=\"2\"><p>". check_output($node->body, 1) ."</p></td></tr>\n";
print " <tr><td colspan=\"2\">&nbsp;</tr></tr>\n";
......@@ -89,7 +89,7 @@ function comment($comment, $link = "") {
// Author:
print " <tr>\n";
print " <td align=\"right\" valign=\"top\">". t("Author") .":</td><td>". format_username($comment->userid) ."</td>\n";
print " <td align=\"right\" valign=\"top\">". t("Author") .":</td><td>". format_username($comment->userid, $comment->name) ."</td>\n";
print " </tr>\n";
// Date
......
......@@ -90,7 +90,7 @@ function node($node, $main = 0) {
<TR><TD COLSPAN="2" BGCOLOR="<?php echo $this->bgcolor1; ?>" WIDTH="100%"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><FONT COLOR="<?php echo $this->fgcolor1; ?>"><B><?php echo "". check_output($node->title) .""; ?></B></FONT></td><td valign="middle" align="center"><IMG SRC="themes/<?php print $this->themename; ?>/images/icon.gif" valign="middle"></td></tr></table></TD></TR>
<TR BGCOLOR="<?php echo $this->bgcolor2; ?>">
<?php
print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node) ."</B>";
print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid, $node->name), "%b" => format_date($node->timestamp, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node) ."</B>";
?>
</TD>
</TR>
......@@ -139,7 +139,7 @@ function comment($comment, $link) {
// Author:
echo " <TR>";
echo " <TD ALIGN=\"right\" VALIGN=\"top\">" . t("Author") . ":</TD><TD><B>" . format_username($comment->userid) . "</B> ";
echo " <TD ALIGN=\"right\" VALIGN=\"top\">" . t("Author") . ":</TD><TD><B>" . format_username($comment->userid, $node->name) . "</B> ";
if ($comment->userid) {
// Display extra information line:
if ($comment->fake_email) $info .= format_email($comment->fake_email);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment