From d016fb14f43976ba184d3e0597065b15f5eca1f0 Mon Sep 17 00:00:00 2001 From: natrak <> Date: Wed, 25 Jul 2001 12:21:48 +0000 Subject: 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. --- account.php | 8 ++++---- includes/comment.inc | 6 +++--- includes/node.inc | 2 +- includes/search.inc | 2 +- modules/rating.module | 4 ++-- node.php | 6 +++--- themes/goofy/goofy.theme | 4 ++-- themes/jeroen/jeroen.theme | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/account.php b/account.php index af2205220..0ac0b7ab2 100644 --- a/account.php +++ b/account.php @@ -404,10 +404,10 @@ function account_track_site() { while ($node = db_fetch_object($nresult)) { $output .= "
  • ". format_plural($node->count, "comment", "comments") ." ". t("attached to") ." 'nid\">". check_output($node->title) ."':
  • "; - $cresult = db_query("SELECT c.subject, c.cid, c.pid, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author WHERE c.lid = $node->nid ORDER BY c.timestamp DESC LIMIT $node->count"); + $cresult = db_query("SELECT c.subject, c.cid, c.pid, u.userid, u.name FROM comments c LEFT JOIN users u ON u.id = c.author WHERE c.lid = $node->nid ORDER BY c.timestamp DESC LIMIT $node->count"); $output .= "\n"; } @@ -416,13 +416,13 @@ function account_track_site() { unset($output); - $result = db_query("SELECT n.title, n.nid, n.type, n.status, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE ". time() ." - n.timestamp < $period ORDER BY n.timestamp DESC LIMIT 10"); + $result = db_query("SELECT n.title, n.nid, n.type, n.status, u.userid, u.name FROM node n LEFT JOIN users u ON n.author = u.id WHERE ". time() ." - n.timestamp < $period ORDER BY n.timestamp DESC LIMIT 10"); if (db_num_rows($result)) { $output .= "\n"; $output .= " \n"; while ($node = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
    ". t("Subject") ."". t("Author") ."". t("Type") ."". t("Status") ."
    nid\">". check_output($node->title) ."". format_username($node->userid) ."$node->type". node_status($node->status) ."
    nid\">". check_output($node->title) ."". format_username($node->userid, $node->name) ."$node->type". node_status($node->status) ."
    "; } diff --git a/includes/comment.inc b/includes/comment.inc index 870d5feb8..757a27c89 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -52,7 +52,7 @@ function comment_form($edit) { global $REQUEST_URI, $user; // name field: - $form .= form_item(t("Your name"), format_username($user->userid)); + $form .= form_item(t("Your name"), format_username($user->userid, $user->name)); // subject field: $form .= form_textfield(t("Subject"), "subject", $edit[subject], 50, 64); @@ -216,7 +216,7 @@ function comment_view($comment, $folded = 0) { // display comment: if ($folded) $theme->comment($comment, $folded); - else print "lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ." by ". format_username($comment->userid) ." ($comment->score)

    "; + else print "lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ." by ". format_username($comment->userid, $comment->name) ." ($comment->score)

    "; } function comment_thread_min($cid, $threshold) { @@ -278,7 +278,7 @@ function comment_render($lid, $cid) { print " SubjectAuthorDateScore\n"; while ($comment = db_fetch_object($result)) { if (comment_visible($comment, $threshold)) { - print " lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ."". format_username($comment->userid) ."". format_date($comment->timestamp, "small") ."". comment_score($comment) ."\n"; + print " lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ."". format_username($comment->userid, $comment->name) ."". format_date($comment->timestamp, "small") ."". comment_score($comment) ."\n"; } } print "\n"; diff --git a/includes/node.inc b/includes/node.inc index 1653415d1..de8b36f19 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -16,7 +16,7 @@ function _node_get($conditions) { } if ($type) { - return db_query("SELECT n.*, l.*, u.userid FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id WHERE $where ORDER BY n.timestamp DESC"); + return db_query("SELECT n.*, l.*, u.userid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id WHERE $where ORDER BY n.timestamp DESC"); } } diff --git a/includes/search.inc b/includes/search.inc index e3cd239c3..5be56fb48 100644 --- a/includes/search.inc +++ b/includes/search.inc @@ -14,7 +14,7 @@ function search_data($keys, $type) { foreach ($result as $entry) { $output .= "

    \n"; $output .= " $entry[title]
    "; - $output .= " $entry[link]". ($entry[user] ? " - ". format_username($entry[user]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") .""; + $output .= " $entry[link]". ($entry[user] ? " - ". format_username($entry[user], $entry[name]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") .""; $output .= "

    \n"; } } diff --git a/modules/rating.module b/modules/rating.module index 166edd12f..1cc82c381 100644 --- a/modules/rating.module +++ b/modules/rating.module @@ -79,12 +79,12 @@ function rating_gravity($id) { } function rating_list($limit) { - $result = db_query("SELECT u.userid, u.rating, r.* FROM users u LEFT JOIN rating r ON u.id = r.user ORDER BY u.rating DESC LIMIT $limit"); + $result = db_query("SELECT u.userid, u.rating, u.name, r.* FROM users u LEFT JOIN rating r ON u.id = r.user ORDER BY u.rating DESC LIMIT $limit"); $output .= "\n"; while ($account = db_fetch_object($result)) { $ranking = $account->old - $account->new; - $output .= ""; + $output .= ""; } $output .= "
    ". ++$i .".". format_username($account->userid) ."". check_output($account->rating) ."(". ($ranking < 0 ? "" : "+") ."$ranking)
    ". ++$i .".". format_username($account->userid, $account->name) ."". check_output($account->rating) ."(". ($ranking < 0 ? "" : "+") ."$ranking)
    \n"; return $output; diff --git a/node.php b/node.php index e6db41913..7482e977d 100644 --- a/node.php +++ b/node.php @@ -77,7 +77,7 @@ function node_failure() { function node_history($node) { global $status; if ($node->status == $status[expired] || $node->status == $status[posted]) { - $output .= "
    ". format_date($node->timestamp) ." by ". format_username($node->userid) .":
    ". check_output($node->log, 1) ."

    "; + $output .= "
    ". format_date($node->timestamp) ." by ". format_username($node->userid, $node->name) .":
    ". check_output($node->log, 1) ."

    "; } if ($node->pid) { $output .= node_history(node_get_object(array("nid" => $node->pid))); @@ -88,11 +88,11 @@ function node_history($node) { $number = ($title ? db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title' AND status = $status[posted]")) : 1); if ($number > 1) { - $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.title = '$title'"); + $result = db_query("SELECT n.*, u.userid, u.name FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.title = '$title'"); while ($node = db_fetch_object($result)) { if (node_access($node)) { - $output .= "

    nid\">". check_output($node->title) ."
    $node->type - ". format_username($node->userid) ." - ". format_date($node->timestamp, "small") ."

    "; + $output .= "

    nid\">". check_output($node->title) ."
    $node->type - ". format_username($node->userid, $node->name) ." - ". format_date($node->timestamp, "small") ."

    "; } } diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme index b2b7bea4c..6c338b18a 100644 --- a/themes/goofy/goofy.theme +++ b/themes/goofy/goofy.theme @@ -102,7 +102,7 @@ function c(subject,mod,author,date,body) {document.writeln("title\" -->\n"; $title = check_output($node->title); - $subleft = strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))); + $subleft = strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid, $node->name), "%b" => format_date($node->timestamp, "large"))); $subright = node_index($node); $body = check_output($node->body, 1) . ($main ? "
    [ " . $this->links(link_node($node)) . " ]
    " : ""); print "\n"; @@ -112,7 +112,7 @@ function c(subject,mod,author,date,body) {document.writeln("
    cid\">\n"; - $author = "" . format_username($comment->userid) . ""; + $author = "" . format_username($comment->userid, $comment->name) . ""; if ($comment->userid) { if ($comment->fake_email) $info[] = format_email($comment->fake_email); if (eregi("http://",$comment->url)) $info[] = format_url($comment->url); diff --git a/themes/jeroen/jeroen.theme b/themes/jeroen/jeroen.theme index 7c9a1a03f..b91cd71f8 100644 --- a/themes/jeroen/jeroen.theme +++ b/themes/jeroen/jeroen.theme @@ -117,7 +117,7 @@ case 12: $how = "Forged"; break; default: $how = "Sneaked through"; } - echo "". strtr(t("$how by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp), "large")) .""; + echo "". strtr(t("$how by %a on %b"), array("%a" => format_username($node->userid, $node->name), "%b" => format_date($node->timestamp), "large")) .""; ?> @@ -192,7 +192,7 @@ // Author: echo " "; - echo "
    ". t("Author") .":". format_username($comment->userid) ." "; + echo " ". t("Author") .":". format_username($comment->userid, $comment->name) ." "; if ($comment->userid) { // Display extra information line: if ($comment->fake_email) $info .= format_email($comment->fake_email); -- cgit v1.2.3