MyBB Community Forums
Modifying ACP pages - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Modifying ACP pages (/thread-220965.html)



Modifying ACP pages - Crazycat - 2018-12-05

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 ?


RE: Modifying ACP pages - Martinex - 2018-12-05

Did you mean this?
/admin/index.php?module=user-banning


RE: Modifying ACP pages - Omar G. - 2018-12-06

You might find useful the following thread:
https://community.mybb.com/thread-220779.html


RE: Modifying ACP pages - Crazycat - 2018-12-06

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


RE: Modifying ACP pages - Omar G. - 2018-12-06

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-Fields-Categories/blob/master/Upload/inc/plugins/ougc_profiecats.php#L36
https://github.com/Sama34/Newpoints-Promotion-System-Integration/blob/master/Upload/inc/plugins/newpoints/newpoints_promotion.php#L37

The newpoints plugin doesn't add a new tab but does adds a new field to the form container.


RE: Modifying ACP pages - chack1172 - 2018-12-07

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
    }
}