Adding widgets to the wire sidebar

Hi guys

I have just started to use this and so far I have found most of it easy but I can't find out how to put widgets onto The Wire sidebar.

I am using The Wire as my front page so need to have things like groups, Tags, Friends

Thanks in advance

 

  • I guess that you've meant 'Owner block' menu, right?

    This menu is displayed in the user' or group' context only.  

    So you can see it on 'thewire/owner/username' page clicking on 'Mine' tab.

    But you can extend this view on sidebar, or override thewire' sidebar view.

  • You can extend the sidebar content of the pages of the Wire plugin to have additional content in the sidebar.

    You would extend the sidebar by creating a plugin that has the following line of code in it's init function in start.php or you could add this line in some customization plugin / your theme plugin:

    elgg_extend_view('thewire/sidebar', 'my_plugin/sidebar');

    And then you would have to add the view mod/my_plugin/views/default/my_plugin/sidebar.php (assuming "my_plugin" is the name of the plugin you add the move to):

    <?php
    
    $list_params = [
        'type' => 'object',
        'limit' => 4,
        'full_view' => false,
        'list_type_toggle' => false,
        'pagination' => false,
    ];
    
    if (elgg_is_active_plugin('blog')) {
        $list_params['subtype'] = 'blog';
        $blogs = elgg_list_entities($list_params);
        echo elgg_view_module('aside', elgg_echo('custom:blogs'), $blogs);
    }
    
    if (elgg_is_active_plugin('groups')) {
        $list_params['type'] = 'group';
        unset($list_params['subtype']);
        $groups = elgg_list_entities($list_params);
        echo elgg_view_module('aside', elgg_echo('custom:groups'), $groups);
    }
    
    $friends = elgg_list_entities_from_relationship([
        'type' => 'user',
        'relationship' => 'friend',
        'relationship_guid' => elgg_get_logged_in_user_guid(),
        'limit' => 4,
        'size' => 'tiny',
        'list_type' => 'gallery',
        'pagination' => false,
        'no_results' => elgg_echo('friends:none'),
    ]);
    echo elgg_view_module('aside', elgg_echo('friends:yours'), $friends);

    This view would add "aside" modules to the sidebar for latest blogs, groups and a user's friends. You can add other modules for other type of content in a simolar way. For the tags I think you wouldn't have to add anything as the tagcloud is already added to the sidebar by the Tagcloud plugin where it's suitable.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking