Owner: ihayredinov
Group members: 2185
Are you new to Elgg and wish to build a new plugin or to customize an existing one to your liking? Do you need an advise, a tip or an idea? Are you looking for the best approach in achieving the results you need? And most importantly, are you ready to do the work yourself, spend time learning programming languages, understanding the script and respecting the coding standards?
If you answered yes, then this group is for you.
Those of us, who have been in this community long enough, understand the value of sharing the knowledge and educating the newcomers - at the end of the day it saves all of us time and effort.
Please read the GUIDELINES before posting:
http://community.elgg.org/pages/view/835629/group-guidelines
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!
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.