Need Help Replacing a page

So, here is the deal, I am writting a plugin that adds some features to a few specific pages. And I'm basically done with it, however, since so far I've been having trouble with rewritting pages, I've done it in the original plugin. 

Basically what I need to do is have the page at the ULR


show my page instead of the one in the plugin (which I still need because the plugin does a bunch of other stuff.)

The origial file was in \mod\tidypics\pages\lists, and I've made my hierarchy match this. 

However, no matter how much I try, I simply cannot get the start.php to regster it correctly; so far I have the flollowing

 ////BEGIN start.php

elgg_register_event_handler('init', 'system', 'spikeDefaultmod_init');

function spikeDefaultmod_init() {

$base_dir = elgg_get_plugins_path() . 'SpikeModDefaults/lib';
elgg_register_page_handler('photos', 'spikeDefault_page_handler');}

function spikeDefault_page_handler($page) {

if (!isset($page[0])) return false;


$base = elgg_get_plugins_path() . 'SpikeModDefaults/pages/photos';
$base_lists = elgg_get_plugins_path() . 'SpikeModDefaults/pages/lists';
switch ($page[0]) {
case "siteimagesowner":
if (isset($page[1])) {
set_input('guid', $page[1]);}
require "$base_lists/siteimagesowner.php";
return false;}

return true;}

which simply freezes and breaks the program. 


I also looked into using the elgg_register_page_handler() function, but it did not help as much as I needed it to. If someone could direct me to the right directio, I would be super glad. I simply cannot wrapmy head around this one. 


Thanks in advance!

  • using elgg_register_page_handler will require you to replace *every* page starting with photos/


    To replace a single page you should look at the route hook


    elgg_register_plugin_hook_handler('route', 'photos', 'my_photos_handler');

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking