Elgg 3.3.15 version.
I wanted to unregister some menu from the topbar i.e. messages, using the plugin bootstrap approach. I can register my plugin hooks via the plugin bootstrap BUT cannot unregister some core/3rd-party plugin hooks. See a code snippet below:
use Elgg\DefaultPluginBootstrap;
class CustomBootstrap extends DefaultPluginBootstrap {
public function init() {
$hook = $this->elgg()->hooks;
$hook->unregisterHandler('register', 'menu:topbar', 'messages_register_topbar');
}
public function activate() {
}
}
I know I can unregister hooks in my_plugin/start.php by using elgg_unregister_plugin_hook_handler('register', 'menu:topbar', 'messages_register_topbar'). But I wanted to replace plugin/start.php with plugin/elgg-plugin.php and plugin/classes/PluginBootstrap.php.
Please advise why the above code snippet cannot unregister plugin hooks.
Thanks!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- seri_ng@seri_ng
seri_ng - 0 likes
- seri_ng@seri_ng
seri_ng - 0 likes
You must log in to post replies.Probably due to plugin order.
You can use the ready() function in the bootstrap to be at a later moment and unregister there
Thanks Jerome for the prompt response!
I thought it might be the plugin order. So I checked wwwroot/admin/plugins and confirmed that my plugin is registered/located after the plugin that I wanted to override.
I will try out the ready( ) as suggested!
Using the ready( ) function is working like a charm!
Thanks again!