PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.0
2.11.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 All 78 releases
← All changes | app/Models/BaseSpace.php +20 -36 2.8.02.11.0 View file →
@@ -6,8 +6,9 @@
6 6 use FluentCommunity\App\Functions\Utility;
7 7 use FluentCommunity\App\Services\CustomSanitizer;
8 8 use FluentCommunity\App\Services\LockscreenService;
9 9 use FluentCommunity\App\Services\Helper;
10 +use FluentCommunity\App\Services\SpaceMenuService;
10 11 use FluentCommunity\Framework\Support\Arr;
11 12
12 13 /**
13 14 * @property int $id
@@ -306,8 +307,9 @@
306 307 }
307 308
308 309 $exisitingSetting = $this->settings;
309 310 $settings['links'] = Arr::get($exisitingSetting, 'links', []);
311 + $settings[SpaceMenuService::SETTINGS_KEY] = Arr::get($exisitingSetting, SpaceMenuService::SETTINGS_KEY, []);
310 312
311 313 if (isset($settings['og_image'])) {
312 314 $ogImageUrl = Arr::get($settings, 'og_image');
313 315 if ($ogImageUrl) {
@@ -493,26 +495,30 @@
493 495 {
494 496 return $this->updateCustomMeta('lockscreen_settings', $settingFields);
495 497 }
496 498
499 + /**
500 + * Sidebar links, emails, invitations, canonical URLs and API payloads all resolve
501 + * through here, so the filter moves every one of them together.
502 + *
503 + * @return string
504 + */
497 505 public function getPermalink()
498 506 {
507 + $permalink = Helper::baseUrl('/');
508 +
499 509 if ($this->type == 'community') {
500 - return Helper::baseUrl('space/' . $this->slug . '/home');
501 - }
502 -
503 - if ($this->type == 'course') {
504 - return Helper::baseUrl('course/' . $this->slug . '/lessons');
505 - }
506 -
507 - if ($this->type == 'sidebar_link') {
508 - $permalink = Arr::get($this->settings, 'permalink');
509 - if ($permalink) {
510 - return $permalink;
510 + $permalink = Helper::baseUrl('space/' . $this->slug . '/home');
511 + } elseif ($this->type == 'course') {
512 + $permalink = Helper::baseUrl('course/' . $this->slug . '/lessons');
513 + } elseif ($this->type == 'sidebar_link') {
514 + $customLink = Arr::get($this->settings, 'permalink');
515 + if ($customLink) {
516 + $permalink = $customLink;
511 517 }
512 518 }
513 519
514 - return Helper::baseUrl('/');
520 + return apply_filters('fluent_community/space_permalink', $permalink, $this);
515 521 }
516 522
517 523 public function getLockscreen()
518 524 {
@@ -637,28 +643,10 @@
637 643 $this->description_rendered = wpautop($this->description);
638 644 $this->membership = $this->getMembership($userId);
639 645 $this->topics = Utility::getTopicsBySpaceId($this->id);
640 646
641 - $headerLinks = [
642 - [
643 - 'title' => __('Posts', 'fluent-community'),
644 - 'route' => [
645 - 'name' => 'space_feeds',
646 - ],
647 - ],
648 - ];
647 + $this->header_links = SpaceMenuService::getMenuLinks($this, $user);
649 648
650 - if (Arr::get($this->permissions, 'can_view_members')) {
651 - $headerLinks[] = [
652 - 'title' => __('Members', 'fluent-community'),
653 - 'route' => [
654 - 'name' => 'space_members',
655 - ],
656 - ];
657 - }
658 -
659 - $this->header_links = apply_filters('fluent_community/space_header_links', $headerLinks, $this);
660 -
661 649 if ($this->isAdmin($userId, true)) {
662 650 return $this;
663 651 }
664 652
@@ -665,13 +653,9 @@
665 653 $this->lockscreen_config = LockscreenService::getLockscreenConfig($this, $this->membership, true);
666 654
667 655 $spaceSettings = $this->settings;
668 656
669 - $spaceLinks = Arr::get($spaceSettings, 'links', []);
670 -
671 - $spaceSettings['links'] = array_values(array_filter($spaceLinks, function ($item) use ($user) {
672 - return Helper::isLinkAccessible($item, $user);
673 - }));
657 + $spaceSettings['links'] = Helper::filterAccessibleLinks(Arr::get($spaceSettings, 'links', []), $user);
674 658
675 659 $this->settings = $spaceSettings;
676 660
677 661 return $this;