Pagehandler Hijack v1.1

Release Notes

- fixes link urls in menu hooks

- fixes compatibility with other plugins that use the 'route', pagehandler hook

- moves settings form to *real* plugin settings page

  • The best way to get requests like this registered is by reporting bugs to github. I only happened upon this by chance. Commenting on random plugins about feature requests for core is not the preferred avenue -- even if Matt Beckett is the author ;).

  • I posted a new issue on github for this item. Evan, I figured I'd talk it over with Matt before submitting an issue just in case I was missing something - or there was another way to get the current pagehandlers I did not know about...

  • i just noticed that the email notifications being sent out by my elgg site include urls that ignore the pagehandler   hijack settings. so, for example, i changed 'pinboards' to 'katalists' in P.H. and the url in the email still includes the path 'pinboards'.
    i looked through the code and saw that getURL() is used to retrieve that url for the notification and that in turn relies on get_entity_url in lib/entities. get_entity_url includes the tip:

    Can be overridden with {@link register_entity_url_handler()}.

    so i think this is a part that is missing from P.H as it is.. do you have any comment matt?
    Thanks

  • urls in notifications isn't something I thought of when I built this, I can't think of any good way to accomplish this as there's no way to know what entity type/subtype pairs put out urls with which page handers and need to be overwritten.  Maybe in 1.9 as there's hooks for entity urls.

  • ok, well, at least the urls still function correctly, even if they are slightly confusing and 'messy' looking.

  • just tested this in 1.9 and the listing page fails.. most likely because the function to retrieve pagehandlers is missing, as already noted in this thread.
    any of the core team got a comment on that? any github issue numbers?
    thanks

  • There was a ticket about it that got closed, I lost the argument sorry

    You'll have to use private API for it as per the comment above

    //get current pagehandlers
    $handlers = array_keys(_elgg_services()->router->getPageHandlers());

  • ah great, thanks - i missed those fixes. i applied them and all is well.

  • just found that i was seeing errors (out of nowhere) relating to me calling a pagehandler_hijack function from within another plugin when the hijack function had not been registered.
    after debugging i found that the cause was that the pagehandler_hijack start.php file contains a direct 'include' directive instead of the standard elgg load php library commands. once i replaced the 'include' with the elgg versions in start.php, the errors stopped.

Matt Beckett

I'm a self-employed web developer, family man, nerd, scuba diver. Manager/maintainer of this elgg community site, and core Elgg development team member.

Stats

  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2015-3-22
  • Downloads: 1475
  • Recommendations: 16

Other Projects

View Matt Beckett's plugins