Plugin to add more Ban Options
Hey all,
I'm currently playing around with the vanilla plugin framework, trying to get used to working with it
So I've tracked down the class to /applications/dashboard/views/user/ban.php , I see no events here so I was wondering how I would make a plugin that would allow you to add more default reasons via a settings page ( which would write to config.php ) without interfering with any other functionality on the page.
Any help would be great
There was an error rendering this rich post.
Best Answers
-
hgtonight MVP
You can add reasons using a theme view override. Copy
/applications/dashboard/views/user/ban.php
to/themes/yourCustomTheme/views/user/ban.php
.You just have to add radio buttons. I would suggest adding them right after line 28.
echo Wrap($this->Form->Radio('Reason', 'You are ugly', array('Value' => 'Ugly')), 'div', array('class' => 'P'));
Add as many as you want. Replace 'You are ugly' with whatever you want to display on the form. Replace 'Ugly' with what ever you want placed in the log.
This pertains to 2.1b1
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
6 -
hgtonight MVP
Use the Render Before magic event and filter based on the sender.
public function UserController_Render_Before($Sender) { if($Sender->RequestMethod == 'ban') { $Sender->View = $this->GetView('view/user/ban.php'); } }
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
1
Answers
You can add reasons using a theme view override. Copy
/applications/dashboard/views/user/ban.php
to/themes/yourCustomTheme/views/user/ban.php
.You just have to add radio buttons. I would suggest adding them right after line 28.
Add as many as you want. Replace 'You are ugly' with whatever you want to display on the form. Replace 'Ugly' with what ever you want placed in the log.
This pertains to 2.1b1
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Yeah I'm aware of theme overrides :P , but I was wondering if this would be possible as a plugin?
There was an error rendering this rich post.
Use the Render Before magic event and filter based on the sender.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
It would definitely be possible. If you can do override it with a theme, you can override it with a plugin. Sort of "if you can dodge a wrench, you can dodge a ball".
My shop | About Me
either mostly through jquery , dodging a wrench
or add your own event, then write a plugin or , dodging a wrench
write a ban2 that mimics what ban1 does and keep it all inside plugin. , dodging a ball
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.