Removing a activity stream from dashboard

Hi does anyone know how to remove the activity stream of a plugin e.g HypePortfolio from the dashboard? Reallly need help with this.

  • The proper way of doing it:

    1. Create a new plugin (see documentation for details)

    2. Register a plugin hook

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

    function my_river_hook($hook, $type, $return, $params) {

    $remove_subtypes = array('hjeducation', 'hjexperience', 'hjskill', 'hjlanguage');

    $subtype = elgg_extract('subtype', $params, false);

    if ($subtype && in_array($subtype, $remove_subtypes)) {

    return false;

    }

    return true;

    }

     

    The above will register a hook for the following trigger found in engine/lib/river.php:

     

    $params = array(

    'type' => $type,

    'subtype' => $subtype,

    'action_type' => $action_type,

    'access_id' => $access_id,

    'view' => $view,

    'subject_guid' => $subject_guid,

    'object_guid' => $object_guid,

    'annotation_id' => $annotation_id,

    'posted' => $posted,

    );

     

    // return false to stop insert

    $params = elgg_trigger_plugin_hook('creating', 'river', null, $params);

    if ($params == false) {

    // inserting did not fail - it was just prevented

    return true;

    }

     

    Every time the plugin is attempting to add an item to a river with a subtype added to the array $remove_subtypes, your hook will prevent that action.

  • @Ismayil:

    Thanks for the reminder that your posted code points me to ;-)

    I was planning to pull Elgg-community_customizations
    to do some simple patches to block 'junk' kind of stuff on the river - people :-
    -- Making so-o-o many fiends - clogging the Comm River,
    -- Updating their Profiles umpteem times in several minutes,
    -- Updating their Avatars umpteem times in several minutes,
    and that sort of ckunky stuff that clouds the River when we're loooking
    for some juicy *technical posts `n stuff.

    Funny thing is that after coding those changess --
    I seem to 'lost' all my code..
    Somewhere on my Desktop or Drive C: or XAMPP'shtdocs ;-P 
    and so I gonna have to code all that again ! ;-(

    But PlZ - nobody laugh at my sloppiness !
    I'm the kinda Developer that has 500+ items on my Desktop
    and a few hunderd scattered on XAMPP ;-oO;X

    But thanks to your reference to the
    'elgg_register_plugin_hook_handler('creating', 'river', ..
    I kinda remember most of that lost code ;-)
    And so back working on that code..
    and maybe soon gotta do my 'newbie' struggles
    with GitHub Web interface + Git GUI stuffs.


  • :) Just realized that you might want to be a little more attentive when you do this than I am while posting my previous post. Of course, you need to return $params, not true.

  •  

    Hi the code i added to my start.php file is below, however the HypePortfolio activities are still being added to the dashboard. What am i doing wrong?

     

    function activityStreamEdit_init() {

    // Load system configuration

    global $CONFIG;

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

    }

     

    function my_river_hook($hook, $type, $return, $params) {

    $remove_subtypes = array('hjeducation', 'hjexperience', 'hjskill', 'hjlanguage', 'hjportfoliofile');

    $subtype = elgg_extract('subtype', $params, false);

    if ($subtype && in_array($subtype, $remove_subtypes)) {

    return false;

    }

    return true;

    }

     

  • You forgot to initialize your plugin :)

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

     

    function activityStreamEdit_init() {

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

    }

    function my_river_hook($hook, $type, $return, $params) {

     

        $remove_subtypes = array('hjeducation', 'hjexperience', 'hjskill', 'hjlanguage', 'hjportfoliofile');

     

        $subtype = elgg_extract('subtype', $params, false);

     

        if ($subtype && in_array($subtype, $remove_subtypes)) {

     

            return false;

        }

     

        return $return;

    }

  • @JF:
    Now thatsh wot I likes to see ;)
    Someone newbie-like looking but not
    afraid to roll sleeves and just try N test out code..
    In my good books..;-P



  • @Dhrup thanks alot :)

    But unfortunately the posts are still going to the activity stream in the dashboard :(

    I even deactivated anad re-activated the plugin.

Feedback and Planning

Feedback and Planning

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