| @@ -224,13 +224,26 @@ | ||
| 224 | 224 | return $this->belongsToMany(Course::class, 'fcom_space_user', 'user_id', 'space_id') |
| 225 | 225 | ->withPivot([ 'role', 'created_at' ]); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | + /** | |
| 229 | + * @deprecated 2.8.2 Use notificationPreferences() - preferences no longer live | |
| 230 | + * in fcom_notification_users. | |
| 231 | + */ | |
| 228 | 232 | public function notificationSubscriptions() |
| 229 | 233 | { |
| 230 | 234 | return $this->hasMany(NotificationSubscription::class, 'user_id'); |
| 231 | 235 | } |
| 232 | 236 | |
| 237 | + /** | |
| 238 | + * Explicit notification preference overrides across every channel. | |
| 239 | + * Recipient selection for email fan-outs is driven off this relation. | |
| 240 | + */ | |
| 241 | + public function notificationPreferences() | |
| 242 | + { | |
| 243 | + return $this->hasMany(NotificationPreference::class, 'user_id', 'ID'); | |
| 244 | + } | |
| 245 | + | |
| 233 | 246 | public function space_pivot() |
| 234 | 247 | { |
| 235 | 248 | return $this->belongsTo(SpaceUserPivot::class, 'ID', 'user_id')->withoutGlobalScopes(); |
| 236 | 249 | } |
| @@ -550,8 +563,9 @@ | ||
| 550 | 563 | $hasDocuments = defined('FLUENT_COMMUNITY_PRO') && Arr::get($space->settings, 'document_library') == 'yes'; |
| 551 | 564 | $hasMediaGallery = defined('FLUENT_COMMUNITY_PRO') && Arr::get($space->settings, 'media_gallery') == 'yes'; |
| 552 | 565 | |
| 553 | 566 | $isRestrictedPost = Arr::get($space->settings, 'restricted_post_only') == 'yes'; |
| 567 | + $isVerifiedPostOnly = Arr::get($space->settings, 'verified_post_only') == 'yes'; | |
| 554 | 568 | |
| 555 | 569 | $documentAccess = Arr::get($space->settings, 'document_access'); |
| 556 | 570 | $mediaAccess = Arr::get($space->settings, 'media_access'); |
| 557 | 571 | |
| @@ -595,9 +609,9 @@ | ||
| 595 | 609 | $permissions['can_view_media'] = false; |
| 596 | 610 | } |
| 597 | 611 | } elseif ($role == 'member' || $role == 'student') { |
| 598 | 612 | $permissions = [ |
| 599 | - 'can_create_post' => $isRestrictedPost ? false : true, | |
| 613 | + 'can_create_post' => $isRestrictedPost ? false : (!$isVerifiedPostOnly || $this->isVerified()), | |
| 600 | 614 | 'registered' => true, |
| 601 | 615 | 'can_view_posts' => true, |
| 602 | 616 | 'can_view_members' => $space->canViewMembers($this), |
| 603 | 617 | 'can_comment' => true, |