How to hide "avatar updates" and "bob is now friend of jack" of non friends ? (elgg 1.11)

My english is not very good, so i hope you understand my question.

I use Elgg 1.11.2.

Thank you.

  • Any idea ? It would be nice to hide non-friends contents...

    Thank you.

  • This can be done by using the 'creating', 'river' plugin hook. Register a function for this hook in the init function of a plugin (e.g. add the code to start.php of your theme or create a new plugin that only needs to consist of manifest.xml and start.php):

    elgg_register_plugin_hook_handler('creating', 'river', 'suppress_river_entries');

    and add the callback function also in start.php outside of the init function:

    function suppress_river_entries($hook, $type, $value, $params) {
        $action_type = $value['action_type'];
        $view = $value['action_type'];
        // no river entries on avatar uploads
        if (($action_type == 'update') && ($view == 'river/user/default/profileiconupdate')) {
            return false;
        }
        // no river entries about friending
        if (($action_type == 'friend') && ($view == 'river/relationship/friend/create')) {
            return false;
        }
        return true;
    }

  • How to disable likes update?

  • I tried your code. I created a plugin "Hide some river entries", but now every posts are hidden : avatar update, friending, message, ...

    Please, help !!!

    Thank you.

  • @gfontaniere Sorry. Two (!) bugs in the code. The following should work (tested this time):

    <?php

    elgg_register_event_handler('init', 'system', 'river_suppress_init');

    function river_suppress_init() {
        elgg_register_plugin_hook_handler('creating', 'river', 'suppress_river_entries');
    }

    function suppress_river_entries($hook, $type, $value, $params) {
        $action_type = $value['action_type'];
        $view = $value['view'];
        // no river entries on avatar uploads
        if (($action_type == 'update') && ($view == 'river/user/default/profileiconupdate')) {
            return false;
        }
        // no river entries about friending
        if (($action_type == 'friend') && ($view == 'river/relationship/friend/create')) {
            return false;
        }
    }

    @Umair Ali: I'm not aware that the bundled Likes plugin adds any river entries by default, so I can't say what would have to be added to suppress river entries on likes. I guess you are using a 3rd party plugin that adds these kind of entries in the river for likes. You would have to find out which plugin it is and then find the 'view' and 'action' used in the corresponding elgg_create_river() function call within this plugin. If you know these two parameters, you can add another if-clause in the above code to suppress the corresponding river entries.

  • Thank you very much. It works perfectly.

    Great job !!!