Hello,
for a new Elgg project of mine, I want to completely disable/hide the "Filter" menu. I have already found out how I can do that, and it works smoothly.
The only problem is that the "Edit avatar" button is only available in the "Filter" menu of the "edit profile" section, and thus isn't available when hiding the "Filter" menu in general.
I would like to move the "Edit avatar" button to another menu, like this:
Current situation (page: [domain]/profile/[username]/edit):

Wanted situation (page: [domain]/profile/[username]; ignore the button design):

I would like the "Edit avatar" button to be the same design as the "Edit profile" button, except with a different icon.
What I tried:
I copied the page "mod/profile/classes/Elgg/Profile/Menus/Title.php" to "My_Plugin" and added the following code under the "edit_profile" code:
$return[] = \ElggMenuItem::factory([
'name' => 'edit_profile_header',
'href' => elgg_generate_entity_url($user, 'edit', 'header'),
'text' => elgg_echo('profile:edit:header'),
'icon' => 'camera',
'class' => ['elgg-button', 'elgg-button-action'],
]);
Then I uploaded the file and invalidated the cache. Unfortunately, nothing happened.
I then tried adding 'priority' => 50 and 60, respectively, because that's how it looked in the "Filter" menu, but it also didn't change anything.
Now my questions:
1. Was this the right idea anyway? It seemed logically to me, at least, from my still limited understanding of Elgg.
2. Did I even put the file into the right place under "My_Plugin"? The original position "mod/profile/classes/Elgg/Profile/Menus/Title.php" irritates me. I have put the file in various positions under "My_Plugin", but since nothing happened whatsoever, I don't know if my code is wrong or the place or both. Could anyone write the exact place if "mod/my_plugin" is the baseline?
3. If my line of thought was wrong in the first place, how could I get an "Edit avatar" button next to the "Edit profile" button on the user's "Profile" page? Or if this is not possible, could an "Edit avatar" link be added to the user menu in the topbar instead, e.g. under the "Profile" link? I would need a hint how/where to do that.
Thanks for any 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.
- Nikolai Shcherbin@rivervanrain

Nikolai Shcherbin - 0 likes
- elggnoob@elggnoob

elggnoob - 0 likes
You must log in to post replies.You forgot to register the event 'register' => 'menu:title' in the elgg-plugin.php.
Now create a file \mod\my_plugin\classes\MyPlugin\Profile\Menus\Title.php with this code:
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!