@fokana, the route:rewrite hook can help you in catching the rewritten url's, to actually rewrite an URL of an entity (eg blog) look at the 'entity:url' hook http://learn.elgg.org/en/stable/guides/hooks-list.html#other
if you wish to rewrite menu item URL's look at the 'prepare' 'menu:<menu name>' hook.
If you're just writing your own plugin and wish to have your own url's look at http://learn.elgg.org/en/stable/guides/pagehandler.html
PS: It can be a very hard task to (for example) use /blog under /news, but it can be done
it's not my problem down there. there she is :
I am trying to rewrite www.example.com/groups to www.example.com/camerproject
Some of my code:
\\ start.php file
elgg_register_event_handler('init', 'system', 'camerproject_init');
function camerproject_init(){
elgg_register_plugin_hook_handler('route:rewrite', 'groups', 'groups_rewrite_handler');
}
function groups_rewrite_handler($hook, $type, $value, $params) {
if (!$value['segments']) {
$value['identifier'] = 'camerproject';
}
return $value;
}
But it does not work
regards,
elgg_register_plugin_hook_handler('route:rewrite', 'groups', 'myplugin_rewrite_handler');
function myplugin_rewrite_handler($hook, $type, $value, $params) {
$value['identifier'] = 'camerproject';
return $value;
}
1. You should create
elgg_register_page_handler('camerproject', 'camerproject_page_handler');
2. Add
elgg_register_plugin_hook_handler('route:rewrite', 'groups', 'myplugin_rewrite_handler');
after
elgg_register_event_handler('init', 'system', 'myplugin_init');
before
function myplugin_init() {
3. Deactivate and activate again your myplugin
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.