PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
← All changes | app/Models/User.php +29 -3 2.7.52.10.0 View file →
@@ -107,9 +107,9 @@
107 107 }
108 108 return '';
109 109 }
110 110
111 - if (Utility::getPrivacySetting('enable_gravatar') != 'yes') {
111 + if (Utility::getPrivacySetting('enable_gravatar') == 'no') {
112 112 return apply_filters('fluent_community/default_avatar', FLUENT_COMMUNITY_PLUGIN_URL . 'assets/images/placeholder.png', $this->ID);
113 113 }
114 114
115 115 $hash = md5(strtolower(trim($this->attributes['user_email'])));
@@ -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 }
@@ -286,8 +299,9 @@
286 299
287 300 return $this;
288 301 }
289 302
303 + // WP account real name (first + last, falling back to wp_users.display_name). Not the public community name — use getPublicDisplayName() for anything shown to other members.
290 304 public function getDisplayName()
291 305 {
292 306 $user = get_user_by('ID', $this->ID);
293 307 $name = '';
@@ -300,8 +314,19 @@
300 314
301 315 return $user->display_name;
302 316 }
303 317
318 + // Public community name (xprofile.display_name, falling back to wp_users.display_name). Use this for actor names in notifications/emails to avoid leaking the legal name.
319 + public function getPublicDisplayName()
320 + {
321 + $name = $this->xprofile ? $this->xprofile->display_name : '';
322 + if (!$name) {
323 + $name = $this->display_name;
324 + }
325 +
326 + return apply_filters('fluent_community/public_display_name', $name, $this);
327 + }
328 +
304 329 public function getCustomMeta($key, $default = null)
305 330 {
306 331 $exist = Meta::where('object_type', 'user')
307 332 ->where('object_id', $this->ID)
@@ -538,8 +563,9 @@
538 563 $hasDocuments = defined('FLUENT_COMMUNITY_PRO') && Arr::get($space->settings, 'document_library') == 'yes';
539 564 $hasMediaGallery = defined('FLUENT_COMMUNITY_PRO') && Arr::get($space->settings, 'media_gallery') == 'yes';
540 565
541 566 $isRestrictedPost = Arr::get($space->settings, 'restricted_post_only') == 'yes';
567 + $isVerifiedPostOnly = Arr::get($space->settings, 'verified_post_only') == 'yes';
542 568
543 569 $documentAccess = Arr::get($space->settings, 'document_access');
544 570 $mediaAccess = Arr::get($space->settings, 'media_access');
545 571
@@ -583,9 +609,9 @@
583 609 $permissions['can_view_media'] = false;
584 610 }
585 611 } elseif ($role == 'member' || $role == 'student') {
586 612 $permissions = [
587 - 'can_create_post' => $isRestrictedPost ? false : true,
613 + 'can_create_post' => $isRestrictedPost ? false : (!$isVerifiedPostOnly || $this->isVerified()),
588 614 'registered' => true,
589 615 'can_view_posts' => true,
590 616 'can_view_members' => $space->canViewMembers($this),
591 617 'can_comment' => true,
@@ -754,9 +780,9 @@
754 780 if ($exist) {
755 781 $data = array_diff_key($data, [ 'avatar' => true, 'username' => true ]);
756 782
757 783 if (apply_filters('fluent/community/user_wp_user_registered_date', true, $this)) {
758 - $data['created_at'] = $this->user_registered;
784 + $data['created_at'] = get_date_from_gmt($this->user_registered, 'Y-m-d H:i:s');
759 785 }
760 786
761 787 $data['meta'] = wp_parse_args($exist->meta, $data['meta']);
762 788 $exist->fill($data);