add username after firstname/lastname for FORUM - ref #4030

skala
Hubert Borderiou 14 years ago
parent 19cd6c9284
commit b22f23b51f
  1. 3
      main/forum/iframe_thread.php
  2. 7
      main/forum/index.php
  3. 42
      main/forum/viewforum.php
  4. 6
      main/forum/viewthread_flat.inc.php
  5. 4
      main/forum/viewthread_nested.inc.php
  6. 3
      main/forum/viewthread_threaded.inc.php

@ -105,12 +105,13 @@ echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">";
while ($row = Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
echo "<tr>"; echo "<tr>";
echo "<td rowspan=\"2\" class=\"forum_message_left\">"; echo "<td rowspan=\"2\" class=\"forum_message_left\">";
$username = $row['username'];
if ($row['user_id']=='0') { if ($row['user_id']=='0') {
$name = $row['poster_name']; $name = $row['poster_name'];
} else { } else {
$name = api_get_person_name($row['firstname'], $row['lastname']); $name = api_get_person_name($row['firstname'], $row['lastname']);
} }
echo $name.'<br />'; echo $name." ($username)<br />";
echo api_convert_and_format_date($row['post_date']).'<br /><br />'; echo api_convert_and_format_date($row['post_date']).'<br /><br />';
echo "</td>"; echo "</td>";

@ -13,7 +13,7 @@
* multiple forums per group * multiple forums per group
* - sticky messages * - sticky messages
* - new view option: nested view * - new view option: nested view
* - quoting a message * - quoting a message
* *
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @copyright Ghent University * @copyright Ghent University
@ -392,14 +392,17 @@ if (is_array($forum_categories_list)) {
if ($forum['last_poster_name'] != '') { if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name']; $name = $forum['last_poster_name'];
$poster_id = 0; $poster_id = 0;
$username = "";
} else { } else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']); $name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id']; $poster_id = $forum['last_poster_id'];
$userinfo = api_get_user_info($poster_id); //
$username = " (".$userinfo['username'].")"; //
} }
echo '<td nowrap="nowrap">'; echo '<td nowrap="nowrap">';
if (!empty($forum['last_post_id'])) { if (!empty($forum['last_post_id'])) {
echo api_convert_and_format_date($forum['last_post_date']).'<br /> '.get_lang('By').' '.display_user_link($poster_id, $name); echo api_convert_and_format_date($forum['last_post_date']).'<br /> '.get_lang('By').' '.display_user_link($poster_id, $name.$username); //
} }
echo '</td>'; echo '</td>';
echo '<td nowrap="nowrap" align="center">'; echo '<td nowrap="nowrap" align="center">';

@ -354,39 +354,47 @@ if (is_array($threads)) {
echo '<td>'; echo '<td>';
echo '<a href="viewthread.php?'.api_get_cidreq().'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;forum='.Security::remove_XSS($my_forum).'&amp;origin='.$origin.'&amp;thread='.$row['thread_id'].$origin_string.'&amp;search='.Security::remove_XSS(urlencode($my_search)).'" '.class_visible_invisible($row['visibility']).'>'.prepare4display($row['thread_title']).'</a></td>'; echo '<a href="viewthread.php?'.api_get_cidreq().'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;forum='.Security::remove_XSS($my_forum).'&amp;origin='.$origin.'&amp;thread='.$row['thread_id'].$origin_string.'&amp;search='.Security::remove_XSS(urlencode($my_search)).'" '.class_visible_invisible($row['visibility']).'>'.prepare4display($row['thread_title']).'</a></td>';
echo '<td>'.$row['thread_replies'].'</td>'; echo '<td>'.$row['thread_replies'].'</td>';
if ($row['user_id'] == '0') {
$name = prepare4display($row['thread_poster_name']);
} else {
$name = api_get_person_name($row['firstname'], $row['lastname']);
}
echo '<td>'.$row['thread_views'].'</td>'; echo '<td>'.$row['thread_views'].'</td>';
// display the author name
$tab_poster_info = api_get_user_info($row['user_id']);
$poster_username = " (".$tab_poster_info['username'].")";
if ($origin != 'learnpath') {
echo '<td>'.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']).$poster_username).'</td>';
} else {
echo '<td>'.api_get_person_name($row['firstname'], $row['lastname']).'$poster_username</td>';
}
// display the last post name
// if ($row['user_id'] == '0') {
// $name = prepare4display($row['thread_poster_name']);
// } else {
// $name = api_get_person_name($row['firstname'], $row['lastname']);
// }
if ($row['last_poster_user_id'] == '0') { if ($row['last_poster_user_id'] == '0') {
$name = $row['poster_name']; $name = $row['poster_name'];
$last_poster_username = "";
} else { } else {
$name = api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']); $name = api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']);
$tab_last_poster_info = api_get_user_info($row['last_poster_user_id']);
$last_poster_username = " (".$tab_last_poster_info['username'].")";
} }
if ($origin != 'learnpath') {
echo '<td>'.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname'])).'</td>';
} else {
echo '<td>'.api_get_person_name($row['firstname'], $row['lastname']).'</td>';
}
// If the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread. // If the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread.
if (($row['visible'] == '1' OR api_is_allowed_to_edit(false, true)) && $origin != 'learnpath') { if (($row['visible'] == '1' OR api_is_allowed_to_edit(false, true)) && $origin != 'learnpath') {
$last_post = api_convert_and_format_date($row['thread_date']).' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name); $last_post = api_convert_and_format_date($row['thread_date']).' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name.$last_poster_username);
} elseif ($origin != 'learnpath') { } elseif ($origin != 'learnpath') {
$last_post_sql = "SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; $last_post_sql = "SELECT post.*, user.firstname, user.lastname, user.username FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' AND post.c_id=".api_get_course_int_id()." ORDER BY post_id DESC";
$last_post_result = Database::query($last_post_sql); $last_post_result = Database::query($last_post_sql);
$last_post_row = Database::fetch_array($last_post_result); $last_post_row = Database::fetch_array($last_post_result);
$name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']); $name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name); $last_post_info_username = " (".$last_post_row['username'].")";
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name.$last_post_info_username);
} else { } else {
$last_post_sql = "SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; $last_post_sql = "SELECT post.*, user.firstname, user.lastname, user.username FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' AND post.c_id=".api_get_course_int_id()." ORDER BY post_id DESC";
$last_post_result = Database::query($last_post_sql); $last_post_result = Database::query($last_post_sql);
$last_post_row = Database::fetch_array($last_post_result); $last_post_row = Database::fetch_array($last_post_result);
$last_post_info_username = " (".$last_post_row['username'].")";
$name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']); $name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.$name; $last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.$name.$last_post_info_username;
} }
echo '<td>'.$last_post.'</td>'; echo '<td>'.$last_post.'</td>';

@ -38,13 +38,15 @@ if (isset($current_thread['thread_id'])){
} else { } else {
$name = api_get_person_name($row['firstname'], $row['lastname']); $name = api_get_person_name($row['firstname'], $row['lastname']);
} }
$username = $row['username']; //
if ($origin!='learnpath') { if ($origin!='learnpath') {
if (api_get_course_setting('allow_user_image_forum')) { if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($row['user_id'],$name).'<br />'; echo '<br />'.display_user_image($row['user_id'],$name).'<br />';
} }
echo display_user_link($row['user_id'], $name).'<br />'; echo display_user_link($row['user_id'], $name." ($username)").'<br />';
} else { } else {
echo $name. '<br />'; echo $name. ' ('.$username.')<br />';
} }
$group_id = api_get_group_id(); $group_id = api_get_group_id();

@ -47,6 +47,8 @@ foreach ($rows as $post) {
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">"; echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">";
echo "<tr>"; echo "<tr>";
echo "<td rowspan=\"3\" class=\"$leftclass\">"; echo "<td rowspan=\"3\" class=\"$leftclass\">";
$username = $post['username']; //
if ($post['user_id']=='0') { if ($post['user_id']=='0') {
$name=$post['poster_name']; $name=$post['poster_name'];
} else { } else {
@ -55,7 +57,7 @@ foreach ($rows as $post) {
if (api_get_course_setting('allow_user_image_forum')) { if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($post['user_id'],$name,$origin).'<br />'; echo '<br />'.display_user_image($post['user_id'],$name,$origin).'<br />';
} }
echo display_user_link($post['user_id'], $name, $origin).'<br />'; echo display_user_link($post['user_id'], $name." ($username)", $origin)."<br />";
echo api_convert_and_format_date($post['post_date']).'<br /><br />'; echo api_convert_and_format_date($post['post_date']).'<br /><br />';
// get attach id // get attach id
$attachment_list=get_attachment($post['post_id']); $attachment_list=get_attachment($post['post_id']);

@ -158,6 +158,7 @@ unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id
echo "<table width=\"100%\" class=\"forum_table\" cellspacing=\"5\" border=\"0\">"; echo "<table width=\"100%\" class=\"forum_table\" cellspacing=\"5\" border=\"0\">";
echo "<tr>"; echo "<tr>";
echo "<td rowspan=\"3\" class=\"$leftclass\">"; echo "<td rowspan=\"3\" class=\"$leftclass\">";
$username = $rows[$display_post_id]['username'];
if ($rows[$display_post_id]['user_id']=='0') { if ($rows[$display_post_id]['user_id']=='0') {
$name=prepare4display($rows[$display_post_id]['poster_name']); $name=prepare4display($rows[$display_post_id]['poster_name']);
} else { } else {
@ -165,7 +166,7 @@ if ($rows[$display_post_id]['user_id']=='0') {
} }
if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($rows[$display_post_id]['user_id'],$name, $origin).'<br />'; } if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($rows[$display_post_id]['user_id'],$name, $origin).'<br />'; }
echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin).'<br />'; echo display_user_link($rows[$display_post_id]['user_id'], $name." ($username)", $origin)."<br />";
echo api_convert_and_format_date($rows[$display_post_id]['post_date']).'<br /><br />'; echo api_convert_and_format_date($rows[$display_post_id]['post_date']).'<br /><br />';
// get attach id // get attach id
$attachment_list=get_attachment($display_post_id); $attachment_list=get_attachment($display_post_id);

Loading…
Cancel
Save