Jump to content

[SOLVED] How to modify "Move to Trash" only for non-superusers?


PWaddict
 Share

Recommended Posts

add this hook to your ready.php

$this->wire()->addHookBefore('InputfieldCheckbox::render', function($e) {
    if ($e->object->id != "delete_page") return;
    if ($this->wire('user')->isSuperuser() == false) $e->object->label = "Hello World";    
});

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

And with this I can change the "Move to Trash" button's text:

$this->wire()->addHookBefore('InputfieldButton::render', function($e) {
    if ($e->object->id != "submit_delete") return;
    if ($this->wire('user')->isSuperuser() == false) $e->object->value = "Hello World";
});

Thank you @kixe

  • Like 2
Link to comment
Share on other sites

  • PWaddict changed the title to [SOLVED] How to modify "Move to Trash" only for non-superusers?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...