Is it possible to override an already declared Controller method?

After a short absence, I'm back with my odd questions. This time I'd like to override ProfileController_Discussions method, but, obviously, I cannot just redeclare it as Vanilla doesn't like having such a conflict.
What I need to do is changing what happens when User opens the /profile/discussions/ page. It's not just a matter of cosmetic changes, I really need to change the logic, therefore I have to implement a Controller.
At the moment, since the "brute force redeclare" doesn't work, I created a Controller with a slightly different name and it works, but it would be nice if it were possible to avoid this workaround.
As usual, thanks for the help.
0
Comments
We don't really allow redeclares like that right now. Doing what you did is a good idea and you could complete the whole thing by also adding a route that maps /profile/discussions to your new method.
@Todd Thanks for the answer, at least I know I made the right choice. By the way, how do I add the route you mentioned?
My shop | About Me
There is a routes link in the Dashboard. You can use regular expressions in it so you can make something like
/profile/dashboard(.*)
point to/profile/dashboard2$1
.@Todd Thanks, I never noticed it. I learned something new!
My shop | About Me
best do the route like so
^/profile/discussions(/.*)?$
->/profile/discussions2$1
ok it is unlikely that you will have something else with discussions, but it good practice any way.
grep is your friend.
@x00 I tried to configure the Route as you described, but, if I try to open /profile/discussions, that's exactly the page I get, I don't get routed to my other Controller method. Do I have to enable something to make the routes work?
My shop | About Me
No I made a mistake there is no leading slash
^profile/discussions(/.*)?$
->profile/discussions2$1
grep is your friend.
@x00 I'm sorry, I feel quite dumb, but I don't seem to be able to make it work.
To recap, since I can't override Profile_Discussions, I implemented a Profile_DiscussionsList, which can be accessed as /profile/discussionslist. I tried to add a route, so that anyone accessing /profile/discussions would be redirected to /profile/discussionslist, but I can't figure out the syntax.
I thought something like
^profile/discussions(/.*)?$->profile/discussionslist2$1
would work, as it looks like a normal regex to me, yet I get a 404 when I try to access the routed address.Sorry for this repeated question and thanks again for the help.
My shop | About Me
profile/discussionslist2$1
take the 2 out
profile/discussionslist$1
you are not going to profile/discussionslist2/blah/blah blah
you are not going to profile/discussionslist/blah/blah blah
if I answered the question and it worked and saved x00 some time responding maybe he could help me with my asset question - please
If I didn't solve it maybe x00 could help please help me with my asset question
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
A-ha! I didn't spot it! I'm getting old... Thanks for the tip.
My shop | About Me