combined river (friends + own posts)

Hello,

My goal is to make a river which combines my own river posts and the river posts of my friends. I've been trying this for the better part of january now, but I'm not getting any closer. Can anybody help me in this regard?

Thanks :)

  • @fraksken I sent you a message, but also run upgrade.php to make sure the changes take effect

  • sorry the actual function should have been this:

     

    function elgg_view_river_items_special($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);

     

     

     

    $loggedinuser = get_loggedin_user()->guid;

     

     

     

     

    // 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)) {

     

     

    $i=0;

     

     

    foreach($riveritems as $item) {

     

    //added a check for own material

    if ($loggedinuser== $item->subject_guid){

    $ignorecheck=true;

    }

     

    //here is the relationship checks

    else {

    if (check_entity_relationship($loggedinuser,'friend',$item->object_guid)){

     

    $ignorecheck=true;

     

    }

     

     

    if (check_entity_relationship($loggedinuser,'friend',$item->subject_guid)){

     

    $ignorecheck=true;

     

    }

    }

     

    //sorry i had the wrong logic here before (its == not !=)

    if($ignorecheck == true ){

     

    $re_riveritems[$i] = $item;

     

    $i++;

     

    }

     

    //reset 

     

    $ignorecheck=false;

     

    }

     

     

     

     

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

     

    'limit' => 20,

     

    'offset' => $offset,

     

    'items' => $re_riveritems,

     

    'pagination' => $pagination

     

    ));

     

     

     

    }

     

     

     

    return '';

     

    }

     

    this works, is tested... but not radically tested. 

    I did send you a mod standalone version 

  • This works for me, is not heavely tested, but it seems to work...

     

    function elgg_view_river_items_mine_friends($limit = 20, $posted_min = 0, $posted_max = 0, $pagination = true) {

    $user = get_loggedin_user();

    $friends = $user->getFriends();

    $subject_guid = array();

    if ($friends) {

    foreach ($friends as $friend) {

    $subject_guid[] = $friend->getGUID();

    }

    }

    $subject_guid[] = $user->getGUID();

    // Get input from outside world and sanitise it

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

     

    // Get river items, if they exist

    if ($riveritems = get_river_items($subject_guid,0,'','','','',($limit + 1),$offset,$posted_min,$posted_max)) {

     

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

    'limit' => $limit,

    'offset' => $offset,

    'items' => $riveritems,

    'pagination' => $pagination

    ));

    }

    return '';

    }