Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Plugin to add more Ban Options

TamaTama United Kingdom ✭✭✭

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

  • hgtonighthgtonight ∞ · New Moderator
    Answer ✓

    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');
      }
    }
    

    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.

    Tama

Answers

  • TamaTama United Kingdom ✭✭✭

    @hgtonight said:
    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

    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.

  • hgtonighthgtonight ∞ · New Moderator
    Answer ✓

    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');
      }
    }
    

    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.

    Tama
  • businessdadbusinessdad Stealth contributor MVP
    edited May 2013

    @Tama said:
    Yeah I'm aware of theme overrides :P , but I was wondering if this would be possible as a plugin?

    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".

    UnderDog
  • @businessdad said:
    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".

    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.

    UnderDog
Sign In or Register to comment.