mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Added config option check for disable_profiles and removed linking if it is disabled
This commit is contained in:
parent
54aeb23356
commit
3d8f0941ed
@ -4,6 +4,7 @@ namespace SilverStripe\Blog\Model;
|
|||||||
|
|
||||||
use PageController;
|
use PageController;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Control\RSS\RSSFeed;
|
use SilverStripe\Control\RSS\RSSFeed;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
@ -43,6 +44,14 @@ class BlogController extends PageController
|
|||||||
'FilterDescription' => 'Text'
|
'FilterDescription' => 'Text'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If enabled, blog author profiles will be turned off for this site
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private static $disable_profiles = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current Blog Post DataList query.
|
* The current Blog Post DataList query.
|
||||||
*
|
*
|
||||||
@ -68,10 +77,16 @@ class BlogController extends PageController
|
|||||||
/**
|
/**
|
||||||
* Renders a Blog Member's profile.
|
* Renders a Blog Member's profile.
|
||||||
*
|
*
|
||||||
|
* @throws HTTPResponse_Exception
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function profile()
|
public function profile()
|
||||||
{
|
{
|
||||||
|
if ($this->config()->get('disable_profiles')) {
|
||||||
|
$this->httpError(404, 'Not Found');
|
||||||
|
}
|
||||||
|
|
||||||
$profile = $this->getCurrentProfile();
|
$profile = $this->getCurrentProfile();
|
||||||
|
|
||||||
if (!$profile) {
|
if (!$profile) {
|
||||||
|
@ -9,6 +9,7 @@ use SilverStripe\Blog\Model\BlogCategory;
|
|||||||
use SilverStripe\Blog\Model\BlogPostFilter;
|
use SilverStripe\Blog\Model\BlogPostFilter;
|
||||||
use SilverStripe\Blog\Model\BlogTag;
|
use SilverStripe\Blog\Model\BlogTag;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||||
use SilverStripe\Forms\DatetimeField;
|
use SilverStripe\Forms\DatetimeField;
|
||||||
use SilverStripe\Forms\HiddenField;
|
use SilverStripe\Forms\HiddenField;
|
||||||
@ -712,6 +713,16 @@ class BlogPost extends Page
|
|||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if User Profiles has been disabled via config
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getProfilesDisabled()
|
||||||
|
{
|
||||||
|
return Config::inst()->get(BlogController::class, 'disable_profiles');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name').
|
* Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name').
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<% loop $Credits %>
|
<% loop $Credits %>
|
||||||
<% if not $First && not $Last %>, <% end_if %>
|
<% if not $First && not $Last %>, <% end_if %>
|
||||||
<% if not $First && $Last %> <%t SilverStripe\\Blog\\Model\\Blog.AND "and" %> <% end_if %>
|
<% if not $First && $Last %> <%t SilverStripe\\Blog\\Model\\Blog.AND "and" %> <% end_if %>
|
||||||
<% if $URLSegment %>
|
<% if $URLSegment && not $Up.ProfilesDisabled %>
|
||||||
<a href="$URL">$Name.XML</a>
|
<a href="$URL">$Name.XML</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
$Name.XML
|
$Name.XML
|
||||||
|
Loading…
Reference in New Issue
Block a user