how to set the priority of a plugin by default, so that after installation and activation it is at the bottom of plugin list automatically.
I know that we can set the priority in the administration section but how can we set that in code so that when this plugin is installed on another site, by defult it is at the bottom of plugin list.
ihave tried:
elgg_register_event_handler('init', 'system', 'myplugin_init', 999999);
but it does'nt seem to work. please help.
Thanks in advance
Im using elgg 1.8.16
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.
Adding the priority 999999 to the call to 'init', 'system' won't change the plugin order in the admin panel. It does however make sure that the plugin is loaded last (after all the other plugins have been loaded). The same way as it would be loaded if it had default priority and was at the bottom of the plugin list.
I want to do it programatically only beacuse im using elgg multisite by marcus povey
Thanks for the quick response,
but it is not making any difference, I have tried that already, if i place my plugin at the bottom, it overrides the search in the header but after setting elgg_register_event_handler('init', 'system', 'myplugin_init', 999999); it does not do that.
As I said: the plugin does not have to be at the bottom of the list if the priority has been set explicitly by passing in the priority parameter.
Is there some reason why this is not enough?
How are you overriding the search?
My bad. The registration order does not apparently affect view loading after all. (Assuming you are overriding a view in your pluigin.)
Maybe you could add something like $plugin->setPriority('last'); to the activate.php. I'm not completely sure if that would work. activate.php may be too early.
@Rohit
You can add a kind of priority in manifest.xml. Like,
<requires>
<type>priority</type>
<priority>after</priority>
<plugin>search</plugin>
</requires>
@gille i have done that but it only indicates in administration that the plugin requires to be place below another plugin, but id does not do that automatically.
@ Juho Jaakkola yes im trying to override search view in my plugin.
@Rohit I see, did you try what Juho suggested, maybe in your plugin init?
$plugin = elgg_get_plugin_from_id('myplugin');
$plugin->setPriority('last');
- Previous
- 1
- 2
- Next
You must log in to post replies.