AFAIK custer, Decorators won't work in this sense for controllers. I don't believe it is setup to check whether functions exist on the extensions. I ran into trouble with this myself. Haven't dug much deeper into it.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
AFAIK custer, Decorators won't work in this sense for controllers. I don't believe it is setup to check whether functions exist on the extensions. I ran into trouble with this myself. Haven't dug much deeper into it.
So for this issue, the only workaround is to hack the core and add the function that you post and add that function in the $allowed_actions? Thanks by the way for the quick response. :)
By the way, I'm working on the 2.4.0 version of SilverStripe.
I'd like to add to this thread, because I was looking for a similar logout solution, since the ?BackURL doesn't work on Security/logout.
My problem was that I needed the logout action to work anywhere and I didn't want to hard-code it into the template because the base href will direct it to domain.com/logout instead of domain.com/page/logout. Ergo, my solution was:
in Page.php -> Page_Controller
public function LogoutLink() {
return $this->Link('logout');
}
function logout() {
if($mem = Member::currentUser()) {
$mem->logOut();
}
return Director::redirect("home/");
}
Simply insert $LogoutLink anywhere you have a logout link on your site. It'll log the user out no matter what page they were on.
- Previous 10 entries
- 1
- Page 22(current)