Modifying ACP pages
#1
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 ?
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM
Reply
#2
Did you mean this?
/admin/index.php?module=user-banning
Reply
#3
You might find useful the following thread:
https://community.mybb.com/thread-220779.html
Reply
#4
(12-06-2018, 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.
[MyBB 1.8 mods] - Offer me a coffee
Do not ask me help through PM
Reply
#5
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.
Reply
#6
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
    }
}
[Image: ZbrcFs]

[Image: xWEF8R]

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)