1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » Archive widget doesn't work
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 3984 Views |
-
Archive widget doesn't work

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
-
Re: Archive widget doesn't work

14 July 2009 at 2:14am
I'm experiencing the same error. I've opened an bug ticket.
-
Re: Archive widget doesn't work

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.
-
Re: Archive widget doesn't work

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.
-
Re: Archive widget doesn't work

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.
-
Re: Archive widget doesn't work

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.
-
Re: Archive widget doesn't work

19 July 2009 at 5:59am Last edited: 28 September 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'];
}
... -
Re: Archive widget doesn't work

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.
| 3984 Views | ||
| Go to Top | Next > |





