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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Blog Module /

Discuss the Blog Module.

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

Archive widget doesn't work


Go to End


22 Posts   6436 Views

Avatar
adesweb

Community Member, 39 Posts

10 July 2009 at 10:37pm

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

Community Member, 176 Posts

14 July 2009 at 2:14am

I'm experiencing the same error. I've opened an bug ticket.

Avatar
Bruce B

Community Member, 164 Posts

14 July 2009 at 6:57pm

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

Community Member, 176 Posts

14 July 2009 at 7:38pm

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

Community Member, 3 Posts

16 July 2009 at 4:46pm

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

Community Member, 164 Posts

16 July 2009 at 5:21pm

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

Community Member, 7 Posts

19 July 2009 at 5:59am

Edited: 28/09/2009 8:59pm

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

Community Member, 18 Posts

29 July 2009 at 3:47am

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