MyBB Community Forums

Full Version: Modifying ACP pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there Smile

I wanted to add a type of banning in the ACP (module=config-banning), but if I can add a tab using the hook admin_config_banning_start, but it's the only thing I can do, everything else is overrided due to the "switch($mybb->input['type'])" just after the hook.

Is there a way I didn't see, other than adding a new ACP page ?
Did you mean this?
/admin/index.php?module=user-banning
You might find useful the following thread:
https://community.mybb.com/thread-220779.html
(2018-12-06, 06:16 AM)OmarĀ G. Wrote: [ -> ]You might find useful the following thread:
https://community.mybb.com/thread-220779.html

Well, this create a new page in the ACP, what I'm looking for is a way to modify an existing page. I know how to add parts in the ACP, I already did that. But it seems impossible to add options or sub-tabs in admin pages created by the core with the existing hooks.
Oh, that is a little more complex, you can check some of my plugins to see how to do this.
https://github.com/Sama34/OUGC-Profile-F...ts.php#L36
https://github.com/Sama34/Newpoints-Prom...on.php#L37

The newpoints plugin doesn't add a new tab but does adds a new field to the form container.
Have you tried hooking to admin_user_banning_begin? From here you can add a tab and then check "$mybb->input['action']" to show your page:
$plugins->add_hook('admin_user_banning_begin', 'myplugin_banning');
function myplugin_banning()
{
    global $sub_tabs, $mybb, $page, $lang;
    $sub_tabs['myban'] = [
        'title' => 'My Ban',
        'description' => ' My ban description',
        'link' => 'index.php?module=user-banning&action=myban'
    ];
    if ($mybb->input['action'] == 'myban') {
        // Your admin page code here
    }
}