Log in
Feedback and Planning

Feedback and Planning

Discussions about the past, present, and future of Elgg and this community site.

How to remove All tab from activity page

Can someone give a quick fix to remove the all tab from the activity page.I am using version 1.8.0.1

Replies

  • DhrupDeScoop 600 days ago

      
    PlugIn ? Not Yet ;-(
    Wait for some kind Developer to code this feature ;-) 

  • iconMatrix 600 days ago

    i'll see what it will take Private_River working for 1.8 

     

  • rjcalifornia 600 days ago

    @Steve The views has changed a little bit in elgg 1.8, for instance, part of the code of the nav.php is in root/pages/river

    The part of the code that's there is the one that let you choose which tab is going to be the default one.

    If I were to find the correct view where the tabs are being generated I could extend the view. Probably, I don't know lol

  • Shiva 600 days ago

    @steve :Thnanks Steve your help would be really appriciated

    yeah I too browsed through several files of river but was not able to figure out where the view is being generated. :P

  • iconMatrix 599 days ago

    I figured out how to do it but it seems the file I need to edit to get it done is engine/lib/river.php and I can seem to override that file.

  • Ismayil Khayredinov 599 days ago

    Haven't really studied the code, but my first guess would be to try and unregister the menu item.

    if (elgg_get_context() == 'activity') {

    elgg_unregister_menu_item('filter', 'all');

    }

    I conclude this based on the html code:

    <ul class="elgg-menu elgg-menu-filter elgg-menu-hz elgg-menu-filter-default"><!-- developers:begin navigation/menu/elements/item --><li class="elgg-menu-item-all elgg-state-selected"><a href="http://localhost/hypetest18/activity/all" title="" confirm="">All</a></li><!-- developers:end navigation/menu/elements/item --><!-- developers:begin navigation/menu/elements/item --><li class="elgg-menu-item-mine"><a href="http://localhost/hypetest18/activity/owner/ismayil.khayredinov" title="" confirm="">Mine</a></li><!-- developers:end navigation/menu/elements/item --><!-- developers:begin navigation/menu/elements/item --><li class="elgg-menu-item-friend"><a href="http://localhost/hypetest18/activity/friends/ismayil.khayredinov" title="" confirm="">Friends</a></li><!-- developers:end navigation/menu/elements/item --></ul>

    ul.elgg-menu-filter

    li.elgg-menu-item-all

  • rjcalifornia 599 days ago

    @Ismayil Khayredinov Great piece of code! I have that same from html code, I will study the code next week I think, I am tied up with a lot of stuffs I need to do hehe

  • Ibrahim Hasan 599 days ago

    Change root/pages/river.php to this:

    <?php
    /**
     * Main activity stream list page
     */

    $options = array();

    $page_type = preg_replace('[\W]', '', get_input('page_type', 'friends'));
    $type = preg_replace('[\W]', '', get_input('type', 'friends'));
    $active_section =
    $subtype = preg_replace('[\W]', '', get_input('subtype', ''));
    if ($subtype) {
        $selector = "type=$type&subtype=$subtype";
    } else {
        $selector = "type=$type";
    }

    if ($type != 'friends') {
        $options['type'] = $type;
        if ($subtype) {
            $options['subtype'] = $subtype;
        }
    }

    switch ($page_type) {
        case 'mine':
            $title = elgg_echo('river:mine');
            $page_filter = 'mine';
            $options['subject_guid'] = elgg_get_logged_in_user_guid();
            break;
        case 'friends':
            $title = elgg_echo('river:friends');
            $page_filter = 'friends';
            $options['relationship_guid'] = elgg_get_logged_in_user_guid();
            $options['relationship'] = 'friend';
            break;
        default:
            $title = elgg_echo('river:friends');
            $page_filter = 'friends';
                    $options['relationship_guid'] = elgg_get_logged_in_user_guid();
            $options['relationship'] = 'friend';
            break;
    }

    $activity = elgg_list_river($options);

    $content = elgg_view('core/river/filter', array('selector' => $selector));

    $sidebar = elgg_view('core/river/sidebar');

    $params = array(
        'content' =>  $content . $activity,
        'sidebar' => $sidebar,
        'filter_context' => $page_filter,
        'class' => 'elgg-river-layout',
    );

    $body = elgg_view_layout('content', $params);

    echo elgg_view_page($title, $body);
    After changing this the default would be changed to friends and the all tab would still be there but if someone was to click on it it would redirect to friends. I still doint know how to remove the All Tab button though. This file would only make it unaccessable
  • iconMatrix 599 days ago

    @ib Right, like I said, I can do that, it is overriding the core instead of editing the core I am trying to do.

    @Ismayil Thanks I will work on that

  • rjcalifornia 599 days ago

    Ibrahim Hasan Actually that is not going to accomplish our goal here. Overriding core files is not recommended. That is a bad trick, 'cause actually what I want to code is only to show two tabs, not three.

    @Steve Keep us updated! Let's do this! haha

  • gillie 599 days ago

    @steve Better than overriding core, you could override views/default/page/layouts/content/filter.php

    And ad some kind of conditional to the tabs loop,

    if ($name == 'all' && (elgg_get_context() == 'activity'))
    continue;

     

  • imoni 599 days ago

    Ibrahim Hasan code worked but it still shows the All tab. and other thing is that we should not chage the elgg core codes as Steve said. and the reason behind that is when we upgrade to newer version we need to rechange all the codes........ and Steve :) please do this soon I need this plugin :( and thanks for sharing everything with us :)

  • imoni 599 days ago

    and make it that only admin can view the all tab not users :)

  • iconMatrix 599 days ago

    @mnrtrq @gillie, There are a few files to call that will override the tabs and I have it working except the override to engine/lib/river.php or to pages/river.php. I am trying a page handler in start.php with no luck. 

    It will have the all tab for the admin, just as it does in Private_River for 1.7 

  • Oranyero 596 days ago

    For see only the admin all tab, and user the friends tab:

    <?php

    /**

     * Main activity stream list page

     */

     

    if (elgg_is_admin_logged_in()) {

     

    $options = array();

     

    $page_type = preg_replace('[\W]', '', get_input('page_type', 'all'));

    $type = preg_replace('[\W]', '', get_input('type', 'all'));

    $active_section =

    $subtype = preg_replace('[\W]', '', get_input('subtype', ''));

    if ($subtype) {

    $selector = "type=$type&subtype=$subtype";

    } else {

    $selector = "type=$type";

    }

     

    if ($type != 'all') {

    $options['type'] = $type;

    if ($subtype) {

    $options['subtype'] = $subtype;

    }

    }

     

    switch ($page_type) {

    case 'mine':

    $title = elgg_echo('river:mine');

    $page_filter = 'mine';

    $options['subject_guid'] = elgg_get_logged_in_user_guid();

    break;

    case 'friends':

    $title = elgg_echo('river:friends');

    $page_filter = 'friends';

    $options['relationship_guid'] = elgg_get_logged_in_user_guid();

    $options['relationship'] = 'friend';

    break;

    default:

    $title = elgg_echo('river:all');

    $page_filter = 'all';

    break;

    }

     

    $activity = elgg_list_river($options);

     

    $content = elgg_view('core/river/filter', array('selector' => $selector));

     

    $sidebar = elgg_view('core/river/sidebar');

     

    $params = array(

    'content' =>  $content . $activity,

    'sidebar' => $sidebar,

    'filter_context' => $page_filter,

    'class' => 'elgg-river-layout',

    );

     

    $body = elgg_view_layout('content', $params);

     

    echo elgg_view_page($title, $body);

     

    } else {

     

     

    $options = array();

     

    $page_type = preg_replace('[\W]', '', get_input('page_type', 'friends'));

    $type = preg_replace('[\W]', '', get_input('type', 'friends'));

    $active_section =

    $subtype = preg_replace('[\W]', '', get_input('subtype', ''));

    if ($subtype) {

        $selector = "type=$type&subtype=$subtype";

    } else {

        $selector = "type=$type";

    }

     

    if ($type != 'friends') {

        $options['type'] = $type;

        if ($subtype) {

            $options['subtype'] = $subtype;

        }

    }

     

    switch ($page_type) {

        case 'mine':

            $title = elgg_echo('river:mine');

            $page_filter = 'mine';

            $options['subject_guid'] = elgg_get_logged_in_user_guid();

            break;

        case 'friends':

            $title = elgg_echo('river:friends');

            $page_filter = 'friends';

            $options['relationship_guid'] = elgg_get_logged_in_user_guid();

            $options['relationship'] = 'friend';

            break;

        default:

            $title = elgg_echo('river:friends');

            $page_filter = 'friends';

                    $options['relationship_guid'] = elgg_get_logged_in_user_guid();

            $options['relationship'] = 'friend';

            break;

    }

     

    $activity = elgg_list_river($options);

     

    $content = elgg_view('core/river/filter', array('selector' => $selector));

     

    $sidebar = elgg_view('core/river/sidebar');

     

    $params = array(

        'content' =>  $content . $activity,

        'sidebar' => $sidebar,

        'filter_context' => $page_filter,

        'class' => 'elgg-river-layout',

    );

     

    $body = elgg_view_layout('content', $params);

     

    echo elgg_view_page($title, $body); }

  • iconMatrix 596 days ago

    @Oranyero, Thanks but like I said in the above posts, I am trying to workout the override of the page handlers, the rest of it works just fine. 

    Steve

  • imoni 596 days ago

    Oranyero thanks but better make plugin :)

  • Ismayil Khayredinov 595 days ago

    Just talked to Steve, and he seems to have accomplished the task ;)

  • iconMatrix 595 days ago

     

    done! :)   Private_River_1.8

  • rjcalifornia 595 days ago

    Awesome!

  • imoni 595 days ago

    congrats :)

  • Shiva 594 days ago

    Thanks Steve!!! your plugin works like a charm .... :)

You must log in to post replies.