diff --git a/main/forum/iframe_thread.php b/main/forum/iframe_thread.php index 82b9168033..53784a78c3 100644 --- a/main/forum/iframe_thread.php +++ b/main/forum/iframe_thread.php @@ -105,12 +105,13 @@ echo "
';
if (!empty($forum['last_post_id'])) {
- echo api_convert_and_format_date($forum['last_post_date']).' '.get_lang('By').' '.display_user_link($poster_id, $name); + echo api_convert_and_format_date($forum['last_post_date']).' '.get_lang('By').' '.display_user_link($poster_id, $name.$username); // } echo ' | ';
echo ''; diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index 293964e094..6523ed9e01 100644 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -354,39 +354,47 @@ if (is_array($threads)) { echo ' | '; echo ''.prepare4display($row['thread_title']).' | '; echo ''.$row['thread_replies'].' | '; - if ($row['user_id'] == '0') { - $name = prepare4display($row['thread_poster_name']); - } else { - $name = api_get_person_name($row['firstname'], $row['lastname']); - } echo ''.$row['thread_views'].' | '; + // display the author name + $tab_poster_info = api_get_user_info($row['user_id']); + $poster_username = " (".$tab_poster_info['username'].")"; + if ($origin != 'learnpath') { + echo ''.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']).$poster_username).' | '; + } else { + echo ''.api_get_person_name($row['firstname'], $row['lastname']).'$poster_username | '; + } + // 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') { $name = $row['poster_name']; + $last_poster_username = ""; } else { $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 ''.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname'])).' | '; - } else { - echo ''.api_get_person_name($row['firstname'], $row['lastname']).' | '; - } - // 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') { - $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') { - $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_row = Database::fetch_array($last_post_result); $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 { - $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_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']); - $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 ''.$last_post.' | '; diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php index 7faaee2651..a33dc5cb25 100644 --- a/main/forum/viewthread_flat.inc.php +++ b/main/forum/viewthread_flat.inc.php @@ -38,13 +38,15 @@ if (isset($current_thread['thread_id'])){ } else { $name = api_get_person_name($row['firstname'], $row['lastname']); } + $username = $row['username']; // + if ($origin!='learnpath') { if (api_get_course_setting('allow_user_image_forum')) { echo '
";
+
+ $username = $post['username']; //
if ($post['user_id']=='0') {
$name=$post['poster_name'];
} else {
@@ -55,7 +57,7 @@ foreach ($rows as $post) {
if (api_get_course_setting('allow_user_image_forum')) {
echo ' '.display_user_image($post['user_id'],$name,$origin).' '; } - echo display_user_link($post['user_id'], $name, $origin).' '; + echo display_user_link($post['user_id'], $name." ($username)", $origin)." "; echo api_convert_and_format_date($post['post_date']).' '; // get attach id $attachment_list=get_attachment($post['post_id']); diff --git a/main/forum/viewthread_threaded.inc.php b/main/forum/viewthread_threaded.inc.php index 701f56221b..91d4b66a54 100644 --- a/main/forum/viewthread_threaded.inc.php +++ b/main/forum/viewthread_threaded.inc.php @@ -158,6 +158,7 @@ unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id echo "
|