How do i change predefined ending url ?

Closed220 views

Answers (1)

  • You should use Routing in your custom plugin.
     
    Open start.php and add this code between init() function:
     
    elgg_unregister_page_handler('thewire', 'thewire_page_handler');

    elgg_register_page_handler('hoot_hoot', function ($page) {     if (!isset($page[0])) {
            $page = array('all');
        }     switch ($page[0]) {
            case "all":
                echo elgg_view_resource('thewire/everyone');
                break;         case "friends":
                echo elgg_view_resource('thewire/friends');
                break;         case "owner":
                echo elgg_view_resource('thewire/owner');
                break;         case "view":
                echo elgg_view_resource('thewire/view', [
                    'guid' => elgg_extract(1, $page),
                ]);
                break;         case "thread":
                echo elgg_view_resource('thewire/thread', [
                    'thread_id' => elgg_extract(1, $page),
                ]);
                break;         case "reply":
                echo elgg_view_resource('thewire/reply', [
                    'guid' => elgg_extract(1, $page),
                ]);
                break;         case "tag":
                echo elgg_view_resource('thewire/tag', [
                    'tag' => elgg_extract(1, $page),
                ]);
                break;         case "previous":
                echo elgg_view_resource('thewire/previous', [
                    'guid' => elgg_extract(1, $page),
                ]);
                break;         default:
                return false;
        }
        return true;
    });
     
    Done.