diff --git a/main/social/profile.php b/main/social/profile.php
index beaeed5462..1ad6e78b64 100644
--- a/main/social/profile.php
+++ b/main/social/profile.php
@@ -625,14 +625,24 @@ echo '
';
}
//-----Announcements
- api_display_tool_title(get_lang('Announcements'));
- foreach ($course_list_code as $course) {
- echo '
'.$course['title'].'
';
- echo '
';
- get_all_annoucement_by_user_course($course['dbName'],$user_id);
- echo '
';
- echo '
';
- }
+
+
+ $announcement_content = '';
+ foreach ($course_list_code as $course) {
+ $content = get_all_annoucement_by_user_course($course['dbName'],$user_id);
+ if (!empty($content)) {
+ $announcement_content.= '
'.$course['title'].'
';
+ $announcement_content.= '
';
+ $announcement_content.= $content;
+ $announcement_content.= '
';
+ $announcement_content.= '
';
+ }
+ }
+
+ if(!empty($announcement_content)) {
+ api_display_tool_title(get_lang('Announcements'));
+ echo $announcement_content;
+ }
}
echo '
';
@@ -675,11 +685,11 @@ echo '';
echo '
';
// COURSES LIST
- if ($show_full_profile) {
- api_display_tool_title(ucfirst(get_lang('Courses')));
+ if ($show_full_profile) {
//print_r($personal_course_list);
//echo '
';
if ( is_array($list) ) {
+ api_display_tool_title(ucfirst(get_lang('Courses')));
//Courses whithout sessions
$old_user_category = 0;
$i=1;
'.$course['title'].'
'; - echo ''; - } + + + $announcement_content = ''; + foreach ($course_list_code as $course) { + $content = get_all_annoucement_by_user_course($course['dbName'],$user_id); + if (!empty($content)) { + $announcement_content.= '
'.$course['title'].'
'; + $announcement_content.= ''; + } + } + + if(!empty($announcement_content)) { + api_display_tool_title(get_lang('Announcements')); + echo $announcement_content; + } } echo '