You forgot to register the event 'register' => 'menu:title' in the elgg-plugin.php.
'events' => [
'register' => [
'menu:title' => [
'\MyPlugin\Profile\Menus\Title::register' => [],
],
],
],Now create a file \mod\my_plugin\classes\MyPlugin\Profile\Menus\Title.php with this code:
<?php
namespace MyPlugin\Profile\Menus;
class Title {
public static function register(\Elgg\Event $event) {
$user = $event->getEntityParam();
if (!$user instanceof \ElggUser || !$user->canEdit() || !elgg_in_context('profile')) {
return;
}
$return = $event->getValue();
$return[] = \ElggMenuItem::factory([
'name' => 'avatar:edit',
'icon' => 'image',
'text' => elgg_echo('avatar:edit'),
'href' => elgg_generate_entity_url($user, 'edit', 'avatar'),
'link_class' => ['elgg-button', 'elgg-button-action'],
]);
return $return;
}
}
Fantastic!
Thank you so much for the fast and easily understandable answer.
At least I had the folder path correct in the first try.
The idea for the menu was also the right one, but not fully correct.
And once again, I forgot to register the event in my plugin. That's a lesson you taught me before, but I forgot as I didn't do any updates on my Elgg since last Spring.
I applied the code already and it looks perfect now.
Once again, thank you very much for your help!
Go to qolormah.pl/admin/site_settings
Disable 'New users require manual validation by an administrator'
ok but when i registring i see communication:
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.