| @@ -6,9 +6,8 @@ | ||
| 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; | |
| 11 | 10 | use FluentCommunity\Framework\Support\Arr; |
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | 13 | * @property int $id |
| @@ -307,9 +306,8 @@ | ||
| 307 | 306 | } |
| 308 | 307 | |
| 309 | 308 | $exisitingSetting = $this->settings; |
| 310 | 309 | $settings['links'] = Arr::get($exisitingSetting, 'links', []); |
| 311 | - $settings[SpaceMenuService::SETTINGS_KEY] = Arr::get($exisitingSetting, SpaceMenuService::SETTINGS_KEY, []); | |
| 312 | 310 | |
| 313 | 311 | if (isset($settings['og_image'])) { |
| 314 | 312 | $ogImageUrl = Arr::get($settings, 'og_image'); |
| 315 | 313 | if ($ogImageUrl) { |
| @@ -495,30 +493,26 @@ | ||
| 495 | 493 | { |
| 496 | 494 | return $this->updateCustomMeta('lockscreen_settings', $settingFields); |
| 497 | 495 | } |
| 498 | 496 | |
| 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 | - */ | |
| 505 | 497 | public function getPermalink() |
| 506 | 498 | { |
| 507 | - $permalink = Helper::baseUrl('/'); | |
| 499 | + if ($this->type == 'community') { | |
| 500 | + return Helper::baseUrl('space/' . $this->slug . '/home'); | |
| 501 | + } | |
| 508 | 502 | |
| 509 | - if ($this->type == 'community') { | |
| 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; | |
| 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; | |
| 517 | 511 | } |
| 518 | 512 | } |
| 519 | 513 | |
| 520 | - return apply_filters('fluent_community/space_permalink', $permalink, $this); | |
| 514 | + return Helper::baseUrl('/'); | |
| 521 | 515 | } |
| 522 | 516 | |
| 523 | 517 | public function getLockscreen() |
| 524 | 518 | { |
| @@ -643,9 +637,27 @@ | ||
| 643 | 637 | $this->description_rendered = wpautop($this->description); |
| 644 | 638 | $this->membership = $this->getMembership($userId); |
| 645 | 639 | $this->topics = Utility::getTopicsBySpaceId($this->id); |
| 646 | 640 | |
| 647 | - $this->header_links = SpaceMenuService::getMenuLinks($this, $user); | |
| 641 | + $headerLinks = [ | |
| 642 | + [ | |
| 643 | + 'title' => __('Posts', 'fluent-community'), | |
| 644 | + 'route' => [ | |
| 645 | + 'name' => 'space_feeds', | |
| 646 | + ], | |
| 647 | + ], | |
| 648 | + ]; | |
| 649 | + | |
| 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); | |
| 648 | 660 | |
| 649 | 661 | if ($this->isAdmin($userId, true)) { |
| 650 | 662 | return $this; |
| 651 | 663 | } |