edit profile menu ?

Can't realy find this in docs and code 

In my "user profile" when i click on "edit profile" there is menu under owner block 

where does it come from ? i wan't to make this menu visible whyle in my own profile 

Thankyou for any replies 

p.s. sorry for my bad english (i'm from eu)

  • If I understand you correctly...

    Start your investigation from the core's files with these code snippets there:

    views\default\resources\profile\edit.php -> elgg_view_layout('one_sidebar', $params);

    views\default\page\layouts\one_sidebar.php -> elgg_view('page/elements/sidebar', $vars);

    views\default\page\elements\sidebar.php -> elgg_view('page/elements/owner_block', $vars);

    views\default\page\elements\owner_block.php -> elgg_view_menu('owner_block', array('entity' => $owner));

    So an answer is it comes from menu 'owner_block'

    Now look at these files in Profile plugin:

    mod\profile\views\default\resources\profile\view.php -> elgg_view('profile/layout', array('entity' => $user));

    mod\profile\views\default\profile\layout.php -> 'content' => elgg_view('profile/wrapper'),

    mod\profile\views\default\profile\wrapper.php -> elgg_view('profile/owner_block');

    mod\profile\views\default\profile\owner_block.php -> elgg_view_menu('owner_block', array(..)

    Well, you found it in above file:

    $content_menu = elgg_view_menu('owner_block', array(
        'entity' => elgg_get_page_owner_entity(),
        'class' => 'profile-content-menu',
    ));

    Now you can make you own views\default\profile\owner_block.php (just copy it from Profile plugin and paste to your own theme) and edit this section

  • Menu is "page"  i partialy got it where i wan't it by editing plugins coresponding to it's content like private profiles with "contexts"

    function private_profiles_usersettings_page() {
        if (elgg_get_logged_in_user_guid()) {
    
            $user = elgg_get_page_owner_entity();
            if (!$user) {
                $user = elgg_get_logged_in_user_entity();
            }
            $params = array(
                'name' => 'private_profiles_usersettings',
                'text' => elgg_echo('private_profiles:usersettings'),
                'href' => "private_profiles/usersettings/{$user->username}",
                'contexts' => array('settings', 'profile')
            );
            elgg_register_menu_item('page', $params);
        }
    }
    

    further on i added needed entries from my theme start but it creates duplicate enrty since edit profile is still in context of profile, still trying to figure this out

            if ($owner->guid == $user->guid) {
                elgg_register_menu_item('page', array(
                    'name' => 'edit-avatar',
                    'href' => "/avatar/$user->username/edit",
                    'text' => elgg_echo('avatar:edit'),
                    'section' => 'a',
                    'priority' => 1,
                    'contexts' => array('profile'),
                ));
                elgg_register_menu_item('page', array(
                    'name' => 'edit-profile',
                    'href' => "/profile/$user->username/edit",
                    'text' => elgg_echo('profile:edit'),
                    'section' => 'a',
                    'priority' => 2,
                    'contexts' => array('profile'),
                ));
            }
  • From my theme (in start.php):

    elgg_unregister_event_handler('pagesetup', 'system', 'users_pagesetup');
    elgg_register_event_handler('pagesetup', 'system', 'theme_users_pagesetup');
    
    function theme_users_pagesetup() {
    
        $owner = elgg_get_page_owner_entity();
        $viewer = elgg_get_logged_in_user_entity();
    
        if ($owner) {
            elgg_register_menu_item('page', array(
                'name' => 'edit_avatar',
                'href' => "avatar/edit/{$owner->username}",
                'text' => elgg_echo('avatar:edit'),
                'section' => '1_profile',
                'contexts' => array('profile'),
            ));
    
            elgg_register_menu_item('page', array(
                'name' => 'edit_profile',
                'href' => "profile/{$owner->username}/edit",
                'text' => elgg_echo('profile:edit'),
                'section' => '1_profile',
                'contexts' => array('profile'),
            ));
        }
    
        // topbar
        
    if ($viewer) {
            elgg_register_menu_item('topbar', array(
                'name' => 'usersettings',
                'href' => "settings/user/{$viewer->username}",
                'text' => elgg_view_icon('settings') . elgg_echo('settings'),
                'priority' => 500,
                'section' => 'alt',
            ));
    
            elgg_register_menu_item('topbar', array(
                'name' => 'logout',
                'href' => "action/logout",
                'text' => elgg_echo('logout'),
                'is_action' => true,
                'priority' => 1000,
                'section' => 'alt',
            ));
        }
    }
  • user settings and user statistics still will not show up profile and will create duplicate if added with context 

    i think it might be better to just remove page menu and create new menu with needed items in context 

    depending on what else uses page menu 

    what i'm looking for is a reasonable way to pull this menu content inside of profile 

    seems to do that automatic for private profile plugin but not for block members plugin maybe key's somewhere there