how to merge the friends and mine tab into one on the dashbaord

hoiw do we merge the river dashboard mine and friends tab into one so that it shows both my and friends update intop single column. is there any plugin for that or any changes in the code

  • this is how I did it in engine/lib/river.php:
    (note that i modified the core which is probably not what you want)

    function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '',

    $type = '', $subtype = '', $action_type = '', $limit = 20, $posted_min = 0, $posted_max = 0, $pagination = true) {

     

    // Get input from outside world and sanitise it

    $offset = (int) get_input('offset',0);

     

     

            $myRiverItems = array();

            $friendRiverItems = array();

     

            // display your own and friends' river items

            if($subject_relationship=='friend') {

     

     

                $myRiverItems = get_river_items(get_loggedin_userid(), $object_guid,'',$type,$subtype,$action_type,($limit + 1),$offset,$posted_min,$posted_max);

                $friendRiverItems = get_river_items($subject_guid, $object_guid, $subject_relationship, $type, $subtype, $action_type, ($limit + 1), $offset, $posted_min, $posted_max);

     

                // only display something if either personal or friends' river items exist.

                if ($myRiverItems || $friendRiverItems) {

     

                    if ($myRiverItems && $friendRiverItems) {

     

                        // combine and sort river items

                        $riveritems = array_merge($myRiverItems, $friendRiverItems);

                        usort($riveritems, riverItemCmp);

                        $riveritems = array_reverse($riveritems);

                    }

                    else if($myRiverItems) { // no friends have posted something yet

     

                        $riveritems = $myRiverItems;

                    }

                    else                    // only friends have posted something yet.

                        $riveritems = $friendRiverItems;

     

     

                    if ($riveritems) {

     

                        return elgg_view('river/item/list', array(

                            'limit' => $limit,

                            'offset' => $offset,

                            'items' => $riveritems,

                            'pagination' => $pagination

                        ));

                    }

                }

    //            else

    //                echo "no river items!<p>";

            }

            else {  // display just your own river items

     

     

                // Get river items, if they exist

                if ($riveritems = get_river_items($subject_guid,$object_guid,$subject_relationship,$type,$subtype,$action_type,($limit + 1),$offset,$posted_min,$posted_max)) {

     

                        return elgg_view('river/item/list',array(

                                'limit' => $limit,

                                'offset' => $offset,

                                'items' => $riveritems,

                                'pagination' => $pagination

                        ));

     

                }

            }

     

    return '';

    }

     

    /**

     * helper function that compares the date of two river items.

     *

     * @param array $myRiverItems

     * @param array $friendRiverItems 

     * @return int 0, -1 or 1 depending on equality, etc.

     */

    function riverItemCmp($myRiverItems, $friendRiverItems) {

     

        $myDate = $myRiverItems->posted;

        $friendDate = $friendRiverItems->posted;

     

        if ($myDate == $friendDate) return 0;

        else if($myDate > $friendDate) return 1;

        else return -1;

    }

    changes need to be made in the riverdashboard plugin (nav.php) as well. hope that helps!?

  • whatr are the changes needed in riverdashboard plugin (nav.php) and are there any more changes needed

  • /mod/riverdashboard/views/default/riverdashboard/nav.php

  • que parte del codigo hay que modificar ?

  • @mariano , mira el código s Mr.Earthling '

    yes, look at earthling's code

  • is there a simple way a plugin or something

  • is there a simple way a plugin or something

  • Whatever earthling posted works.

    I didn't test it all but I saw my feeds. I didn't edit the nav.php though just changed the code in river.php. It was pretty simple, not sure about the nav.php and what had to be done there.

  • Hi earthling, I just noticed poll votes from the polls plugin and some other entries do not show anymore? like comments?