Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Archive widget doesn't work


Go to End
Reply

22 Posts   4751 Views

Avatar
adesweb

10 July 2009 at 10:37pm Community Member, 39 Posts

Upon installing the latest version of the blog module, I get the following error when trying to access an archive page (by year in this instance):

Action '2009' isn't allowed on class BlogHolder_Controller

Any ideas?

I am running the latest stable version of SS.

Adrian

Avatar
MarijnKampf

14 July 2009 at 2:14am Community Member, 164 Posts

I'm experiencing the same error. I've opened an [url=http://open.silverstripe.org/ticket/4376]bug ticket[/url].

Avatar
Bruce B

14 July 2009 at 6:57pm Community Member, 145 Posts

I have a temporary workaround, that may point to a solution for those with more knowledge.

After line 176 in blog/BlogHolder.php, add the following to the '$allowed_actions' array:

'2009',
'2008',

Then 2008 and 2009 become allowed actions and the archive works again.

I've also updated the ticket with this text.

Avatar
MarijnKampf

14 July 2009 at 7:38pm Community Member, 164 Posts

Thanks for finding and posting the work around bruceb!

For people not too experienced with Silverstripe the file to patch is blog/code/BlogHolder.php and make sure to patch the BlogHolder_Controller class and not BlogHolder.

Avatar
jdj

16 July 2009 at 4:46pm Community Member, 3 Posts

I just commented out the $allowed_actions array altogether. Probably not the best workaround, but it prevented me from having to enter all the existing and future dates.

Avatar
Bruce B

16 July 2009 at 5:21pm Community Member, 145 Posts

Commenting out the allowed actions is probably not a good idea. The reason for this update is to patch a security hole and removing the $allowed_actions array presumably reopens it, at least partially.

I wouldn't worry about allowing for future dates. If its a new site just enter '2009'. We can be almost certain that a new version of the blog module will be released before the end of 2009.

Avatar
lestatron

19 July 2009 at 5:59am (Last edited: 28 September 2009 8:59pm), Community Member, 7 Posts

I have found a better work around for this problem.


bruceb: 28 September 2009 at 11:13am : "I should mention that I've added 'SearchForm' to the list of allowed actions in blogholder.php as well - otherwise search doesn't work within the blog."

Action added to the allowed actions list.

1) BlogHolder.php (Line 170)
$allowed_actions add 'archive'

...
static $allowed_actions = array(
      'postblog' => 'BLOGMANAGEMENT',
      'post' => 'BLOGMANAGEMENT',
      'BlogEntryForm' => 'BLOGMANAGEMENT',
      'rss',
      'tag',
      'archive',
      'showarchive',
'SearchForm',
   );
...

2) BlogHolder.php function BlogEntries() (Line 199)

...
else if (Director::urlParam('Action') == 'archive')
         {
            $year = Director::urlParam('ID');
            $month = Director::urlParam('OtherID');

...

3) ArchiveWidget.php (Lines 77 & 80 ) function Dates()

...
if($this->DisplayMode == 'month') {
   $link = $blogHolder->Link() . 'archive/' . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']);
} else {
   $link = $blogHolder->Link() . 'archive/' . $sqlResult['Year'];
}
...

Avatar
Ultimate

29 July 2009 at 3:47am Community Member, 18 Posts

Hey lestatron,

I did all your suggested changes, but they don't work for me. The action seems to be allowed now, but the archive just shows all blog-entries, instead of only the entries of the specified month or year.

Go to Top