← All changes
|
Modules/Integrations/FluentCRM/ProfileSection.php
+13
-10
2.5.0
→
2.10.0
View file →
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | $content = ''; |
| 47 | 47 | $xprofile = XProfile::where('user_id', $userId)->first(); |
| 48 | 48 | |
| 49 | 49 | if ($xprofile) { |
| 50 | - $content .= '<a href="' . $xprofile->getPermalink() . '" target="_blank" rel="noopener">' . __('View Community Profile', 'fluent-community') . '</a>'; | |
| 50 | + $content .= '<p style="padding: 0 20px;"><a href="' . $xprofile->getPermalink() . '" target="_blank" rel="noopener">' . __('View Community Profile', 'fluent-community') . '</a></p>'; | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $courseEnabled = Helper::isFeatureEnabled('course_module'); |
| 54 | 54 | |
| @@ -53,9 +53,11 @@ | ||
| 53 | 53 | $courseEnabled = Helper::isFeatureEnabled('course_module'); |
| 54 | 54 | |
| 55 | 55 | $dateFormat = get_option('date_format') . ' ' . get_option('time_format'); |
| 56 | 56 | |
| 57 | - $userSpaces = Space::with('space_pivot') | |
| 57 | + $userSpaces = Space::with(['space_pivot' => function ($query) use ($userId) { | |
| 58 | + $query->where('user_id', $userId); | |
| 59 | + }]) | |
| 58 | 60 | ->whereHas('space_pivot', function ($query) use ($userId) { |
| 59 | 61 | $query->where('user_id', $userId); |
| 60 | 62 | }) |
| 61 | 63 | ->orderBy('title', 'ASC') |
| @@ -60,9 +62,9 @@ | ||
| 60 | 62 | }) |
| 61 | 63 | ->orderBy('title', 'ASC') |
| 62 | 64 | ->get(); |
| 63 | 65 | |
| 64 | - $content .= '<h3>' . __('Spaces', 'fluent-community') . '</h3>'; | |
| 66 | + $content .= '<h3 style="padding: 0 20px;">' . __('Spaces', 'fluent-community') . '</h3>'; | |
| 65 | 67 | |
| 66 | 68 | if ($userSpaces && !$userSpaces->isEmpty()) { |
| 67 | 69 | $tableBuilder = new TableBuilder(); |
| 68 | 70 | foreach ($userSpaces as $space) { |
| @@ -82,15 +84,15 @@ | ||
| 82 | 84 | 'created_at' => __('Member Since', 'fluent-community'), |
| 83 | 85 | ]); |
| 84 | 86 | $content .= $tableBuilder->getHtml(); |
| 85 | 87 | } else { |
| 86 | - $content .= '<p>' . __('No spaces found for this contact.', 'fluent-community') . '</p>'; | |
| 88 | + $content .= '<p style="padding: 0 20px;">' . __('No spaces found for this contact.', 'fluent-community') . '</p>'; | |
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | if ($courseEnabled) { |
| 90 | 92 | $tableBuilder = new TableBuilder(); |
| 91 | 93 | $userCourses = \FluentCommunity\Modules\Course\Services\CourseHelper::getUserCourses($userId); // this will return Collection of Course objects |
| 92 | - $content .= '<h3>' . __('Enrolled Courses', 'fluent-community') . '</h3>'; | |
| 94 | + $content .= '<h3 style="padding: 0 20px;">' . __('Enrolled Courses', 'fluent-community') . '</h3>'; | |
| 93 | 95 | if ($userCourses && !$userCourses->isEmpty()) { |
| 94 | 96 | foreach ($userCourses as $course) { |
| 95 | 97 | $tableBuilder->addRow([ |
| 96 | 98 | 'id' => $course->id, |
| @@ -108,9 +110,9 @@ | ||
| 108 | 110 | 'enrollment_date' => __('Enrolled At', 'fluent-community'), |
| 109 | 111 | ]); |
| 110 | 112 | $content .= $tableBuilder->getHtml(); |
| 111 | 113 | } else { |
| 112 | - $content .= '<p>' . __('No courses found for this contact.', 'fluent-community') . '</p>'; | |
| 114 | + $content .= '<p style="padding: 0 20px;">' . __('No courses found for this contact.', 'fluent-community') . '</p>'; | |
| 113 | 115 | } |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | 118 | $spaceCourses = \FluentCommunity\App\Models\BaseSpace::withoutGlobalScopes() |
| @@ -126,11 +128,11 @@ | ||
| 126 | 128 | |
| 127 | 129 | foreach ($spaceCourses as $spaceCourse) { |
| 128 | 130 | $type = $spaceCourse->type; |
| 129 | 131 | if ($type == 'course') { |
| 130 | - $type = 'Course'; | |
| 132 | + $type = __('Course', 'fluent-community'); | |
| 131 | 133 | } else if ($type == 'community') { |
| 132 | - $type = 'Space'; | |
| 134 | + $type = __('Space', 'fluent-community'); | |
| 133 | 135 | } |
| 134 | 136 | |
| 135 | 137 | $options[] = [ |
| 136 | 138 | 'id' => $spaceCourse->id, |
| @@ -150,11 +152,11 @@ | ||
| 150 | 152 | $removeOptions = []; |
| 151 | 153 | foreach ($removeSpaceCourses as $spaceCourse) { |
| 152 | 154 | $type = $spaceCourse->type; |
| 153 | 155 | if ($type == 'course') { |
| 154 | - $type = 'Course'; | |
| 156 | + $type = __('Course', 'fluent-community'); | |
| 155 | 157 | } else if ($type == 'community') { |
| 156 | - $type = 'Space'; | |
| 158 | + $type = __('Space', 'fluent-community'); | |
| 157 | 159 | } |
| 158 | 160 | |
| 159 | 161 | $removeOptions[] = [ |
| 160 | 162 | 'id' => $spaceCourse->id, |
| @@ -212,8 +214,9 @@ | ||
| 212 | 214 | } |
| 213 | 215 | |
| 214 | 216 | foreach ($spaceIds as $spaceId) { |
| 215 | 217 | $space = BaseSpace::withoutGlobalScopes()->find($spaceId); |
| 218 | + /** @var BaseSpace|null $space */ | |
| 216 | 219 | if ($space) { |
| 217 | 220 | Helper::addToSpace($space, $userId); |
| 218 | 221 | } |
| 219 | 222 | } |