I know that I can modify pages in other plugins with elgg_register_page_handler() in a new plugin. But is there such a feature for pages in the Elgg Core? For example I would like to change something in the file /pages/friends/index.php. How can I do this without hacking the core?
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.
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- ase8038@ase8038
ase8038 - 0 likes
- ase8038@ase8038
ase8038 - 0 likes
You must log in to post replies.Its just like with other plugins. Either unregister the page handler and then register yours or use the root hook.
Example:
Check it on http://weborganizm.com
Ok, thanks to both of you.
I did it exactly like you have suggested it. But my handler is routed to the home page. I suppose that something is wrong with the place I have stored the index.php. I put it to '/mod/myplugin/pages/friends/index.php'. And no matter if I am writing:
require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/index.php");
or
require_once(elgg_get_plugins_path() . "myplugin/pages/friends/index.php");
It doesn't route to my index.php. Any hints?
I found the bug. It was the usual copy & paste error. ;-)
I copied parts of the code from the original friends_page_handler() function in /engine/lib/users.php, but used in my plugin_friends_page_handler() function another name for the parameter $segments.
Now it works fine.
Thanks again for your help.