I am trying something that on the surface should be easy - over-ride another plugin's page handler, specifically the profile plugin's page handler.
My code is pretty simple in start.php of my plugin:
register_page_handler ('profile','my_page_handler');
But my_page_handler never gets called. At the heart of it, I am trying to extend the functionality of profile plugin to handle URLS of the type http://myserver.com/pg/profile/username/<number> According to the documentation of register_page_handler:
A request to register a page handler with the same identifier as previously registered handler will replace the previous one.
I have moved the profile plugin around in the plugin list, but my page_handler gets overwritten by the profile plugin. If I disable the profile plugin, my page handler gets called, but I need the functionality of the profile plugin and don't want to modify the plugin directly if I don't have to.
BTW - is there a search mechanism on this discussion board? Someone else has probably already asked this question, but darn if I or Google could find it.
Sean.
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.
- DhrupDeScoop@Dhrup2000

DhrupDeScoop - 0 likes
- Cash@costelloc

Cash - 0 likes
- Sean Donovan@mrsdonovan

Sean Donovan - 0 likes
- Sean Donovan@mrsdonovan

Sean Donovan - 0 likes
- PaK-Zer0@PaKZer0

PaK-Zer0 - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- Mike Zacher (vazco)@vazco

Mike Zacher (vazco) - 0 likes
- PaK-Zer0@PaKZer0

PaK-Zer0 - 0 likes
- PaK-Zer0@PaKZer0

PaK-Zer0 - 0 likes
- PaK-Zer0@PaKZer0

PaK-Zer0 - 0 likes
You must log in to post replies.I googled "elgg Overriding another plugins page handler" which is your topic's title lolz ;- )
The Elgg way of doing this is to register for the init,system event and in that callback, register your page handler. While this is not necessary (you can just do it in the start.php script), since all the other plugins do it this way, better to follow that pattern. Then you don't have to worry about odd problems like the one you are having.
Ahh, ok let me try that. Thanks.
FYI - You can Google search this forum using "<search topic> site:http://community.elgg.org"
Yahh! That works! Here is the generalized code in start.php:
Thanks Cash!
Hey guys, sorry for bumping an ol' thread but I have the same problem and the solution posted above doesn't work for me
The error message "Hi sir, override here", is written on the error log, but I can't manage to see the "group_handler_in" into the error log =P
In the other hand, I tried to put the plugin up and down from the group plugin, just in the case it makes sense to override the page handler.
Thanks for the help guys =)
Your page_handler function and the actual function names are mismatched.
elgg_register_page_handler('groups', 'new_handler_function');
function new_handler_function() {}
btw, in case you want to extend and not override page_handler, you can use route plugin hook from page_handler method.
@Ismayil: Sorry, my example was bad, it isn't the actual code, but works in the same way, the functions name doesn't mismatch in the real code but thanks anyways pal =)
@Vazco: I'm going to try that approach, thanks =)
I just can't find any plugin hook related to page_handler. I must say also, that i'm using elgg 1.7 . I look'd up inside groups plugin (the page handler I want to override), inside the page_handler.php, and I took a tour in all the plugin hooks triggered inside the engine folder, I just can't see wich hook are you talking about.
The fun fact about all this is that the register_page_handler function returns true but it doesn't do the trick :/
But of course it's a nice clue to keep on searching =)
Ok, IT'S WORKING NOW! =DDDDDD
It did the trick after I set the plugin just right below the groups plugin, but I can't explain it since I tried to put it on the top and the bottom of all plugins without much success.
Thanks you guys so much =)