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 :)

  • @Dhrup: We're aware of the code which needs to be edited. The question is: How will you make a variable hold 2 values? We know that $relationship_type is the one we need. Though, one is blank and the other contains friend. How do you merge a blank and a value?

    @ghumanz: I'm thinking of (and soon will be doing, after my short break) making $relationship_type an array and modifying the functions.

    I'll let you guys know how it goes in a few days. But should anybody have tried already or have another solution, please don't wait to post it :)

    @shyam: Yeah, of course I always copy the code before editing it. I always make duplicate functions. However, I'm not familiar yet with the creation of mods, so I'm messing with the sourcecode (I know it's a very bad thing to do). The priority however is getting this site up and running. When that's done, I can see how these mods work and put everything in a couple of mods.

  • I'was gone crazy but after three days of work i've found a solution.

    I've changed many files, so it is not simple to explain how to adapt the river, but i think i will release a plugin to reach  the goal in a few days.

  • @Manuele :-Nice to hear about your success we will wait for your plugin.......

  • it's not about making a variable holding 2 values,
    but doing 2 separate calls for "mine" and 'friends" - then merging the resultants ->

                case 'friendsmine':
                                $subject_guid1 = $_SESSION['user']->guid;
                                $relationship_type1 = '';
                                $subject_guid2 = $_SESSION['user']->guid;
                                $relationship_type2 = 'friend';
                                break;


    then we an array merge to get something like this  -->

    image

  • Quick and dirty way:

    Copy and paste the Elgg river function:

    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);

     

    // 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 '';

    }

    put this inside your plugin start file

    now change the function to something like:

    function elgg_view_river_items_special

    now on the riverdashboard index where it makes the original function call, change it the same function name you just used in your start file.

    now edit your new function:

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

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

    $ignorecheck=true;

    }

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

    $ignorecheck=true;

    }

    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 should work (albiet I have done similar many times but there could be a bug in this because I didnt go test to make sure)

     

  • @dhrup:- I tried your suggetions but it show all post, please help me here.

    <li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=friends&amp;content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&amp;callback=true'); return false;" href="?display=friends"><?php echo elgg_echo('friends'); ?></a></li>
                <li <?php echo $mineselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?display=mine&amp;content=<?php echo $vars['type']; ?>,<?php echo $vars['subtype']; ?>&amp;callback=true'); return false;" href="?display=mine"><?php echo elgg_echo('mine'); ?></a></li>

     

    How to combine above code.

  •  

    I am busting into this very interesting discussion! This is great scene seeing Elgg coders working together to improve an important area. Great when a few smart around here work together! There isn't enough collaboration considering socials sites entire purpose in “collaboration”, not just sharing informatiom

    I want to ( ! MUST!) spearhead a similar effort in improving the groups areas. The river is important, Facebook has raised people expectations, I'd plan to make groups the most powerful intuitive group space out there.

    Can I appeal to anyone and everyone on this thread to consider looking into helping with A GROUP effort to work on group improvements. Here is my long term spec, and I think and serious business or organization will find these improvements way beyond where groups is now.

    1. Starts with Tunist's "group custom layout"

    2. Uses "group river"

    3. Uses "smart files"

    4. Uses "file manager"

    We have these plugins working, but we need a greatly improved interface. Right now "group custom layout" shows two column widgets on main group page. We would like to have that panel show one column (full wide) group river in default view, and place the widgets behind it on tabbed panel. Tabs are "group activity" and "latest updates", something like that. The full wide group river changes the entire group experience, just like normal river, people want to quick river to what is happening.

    Would anyone be willing to come over help me a new thread to develop a truly massive upgrade of groups? I am working with few "cloud service providers" to integrate online meeting services and scheduling in groups and cloud file management, but first I need some help getting "custom groups layout" with a tabbed full panel and widget panel.

    Where can I start a thread and thanks for reading if you have!

  • @Drup @Zakary Venturo: Thank you very much for your views. I'll give them a try today. As I told you before, I'm not a professional coder, I don't know php as good as I'd want to, and lots of functions/posibilities are still hidden from me, but with this, I'm learning how to be a better person ;). I've been held up from work due to some grave familial issues, however I vowed myself to pick everything back up today.

    @Tahoebilly: I guess you can post your post in the technical support group.

  • @ Zakary Venturo: Ok, So I went ahead and followed your instructions. Now I have the following code in my start file:

    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)

    {
     $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)
     {
     if (check_entity_relationship($loggedinuser,'friend',$item->object_guid))
     { $ignorecheck=true; }
     if (check_entity_relationship($loggedinuser,'friend',$item->subject_guid))
     { $ignorecheck=true; }
     if($ignorecheck != true )
     {
     $re_riveritems[$i] = $item;
     $i++;
     }
     //reset
     $ignorecheck=false;
     }
     return elgg_view('river/item/listtwo', array( 'limit' => 20, 'offset' => $offset, 'items' => $re_riveritems, 'pagination' => $pagination));
    //river/item/listtwo is for my 'filter for the items
     }
     return '';
     }

    In my index file I have the following calling to the function.

    $river = elgg_view_river_items_special($subject_guid, 0, $relationship_type, $type, $subtype, '');

    However, this returns nothing ... Only in the 'friends' river. The 'my river' and the 'site wide' still show as before.

    Any thoughts?