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 ""; while ($row = Database::fetch_array($result)) { echo ""; echo ""; diff --git a/main/forum/index.php b/main/forum/index.php index e82d181dbb..13b8ff4f58 100644 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -13,7 +13,7 @@ * multiple forums per group * - sticky messages * - new view option: nested view - * - quoting a message + * - quoting a message * * @author Patrick Cool , Ghent University * @copyright Ghent University @@ -392,14 +392,17 @@ if (is_array($forum_categories_list)) { if ($forum['last_poster_name'] != '') { $name = $forum['last_poster_name']; $poster_id = 0; + $username = ""; } else { $name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']); $poster_id = $forum['last_poster_id']; + $userinfo = api_get_user_info($poster_id); // + $username = " (".$userinfo['username'].")"; // } echo ''; echo ''; echo ''; - if ($row['user_id'] == '0') { - $name = prepare4display($row['thread_poster_name']); - } else { - $name = api_get_person_name($row['firstname'], $row['lastname']); - } echo ''; + // display the author name + $tab_poster_info = api_get_user_info($row['user_id']); + $poster_username = " (".$tab_poster_info['username'].")"; + if ($origin != 'learnpath') { + echo ''; + } else { + echo ''; + } + // 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 ''; - } else { - echo ''; - } - // 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 ''; 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 '
'.display_user_image($row['user_id'],$name).'
'; } - echo display_user_link($row['user_id'], $name).'
'; + echo display_user_link($row['user_id'], $name." ($username)").'
'; } else { - echo $name. '
'; + echo $name. ' ('.$username.')
'; } $group_id = api_get_group_id(); diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php index 6228f5d29a..8b0d235015 100644 --- a/main/forum/viewthread_nested.inc.php +++ b/main/forum/viewthread_nested.inc.php @@ -47,6 +47,8 @@ foreach ($rows as $post) { echo "
"; + $username = $row['username']; if ($row['user_id']=='0') { $name = $row['poster_name']; } else { $name = api_get_person_name($row['firstname'], $row['lastname']); } - echo $name.'
'; + echo $name." ($username)
"; echo api_convert_and_format_date($row['post_date']).'

'; 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 '
'; 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']).''.$row['thread_replies'].''.$row['thread_views'].''.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']).$poster_username).''.api_get_person_name($row['firstname'], $row['lastname']).'$poster_username'.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname'])).''.api_get_person_name($row['firstname'], $row['lastname']).''.$last_post.'
"; echo ""; 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 ""; echo ""; echo "
"; +$username = $rows[$display_post_id]['username']; if ($rows[$display_post_id]['user_id']=='0') { $name=prepare4display($rows[$display_post_id]['poster_name']); } else { @@ -165,7 +166,7 @@ if ($rows[$display_post_id]['user_id']=='0') { } if (api_get_course_setting('allow_user_image_forum')) {echo '
'.display_user_image($rows[$display_post_id]['user_id'],$name, $origin).'
'; } -echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin).'
'; +echo display_user_link($rows[$display_post_id]['user_id'], $name." ($username)", $origin)."
"; echo api_convert_and_format_date($rows[$display_post_id]['post_date']).'

'; // get attach id $attachment_list=get_attachment($display_post_id);