Skip to:
Content
Pages
Categories
Search
Top
Bottom

small patch to allow plugins to filter ass_digest_record_activity

  • Avatar of sboisvert
    sboisvert
    Participant

    @sboisvert

    I have a small patch, basically a one liner to add the ability to filter $group_activity_ids before it gets committed.

    $group_activity_ids = apply_filters(‘ass_digest_record_activity’,$group_activity_ids,$activity_id, $user_id, $group_id, $type );

    in ass_digest_record_activity() in bp-activity-subsciption-digest.php, just before the meta is updated.

    Here is the full .svn patch file if its of use:
    `

    Index: bp-activity-subscription-digest.php
    ===================================================================
    — bp-activity-subscription-digest.php (revision 10710)
    +++ bp-activity-subscription-digest.php (working copy)
    @@ -411,7 +411,10 @@

    // update multi-dimensional array with the current activity_id
    $group_activity_ids[$type][$group_id][] = $activity_id;
    -
    +
    + //allow other plugins to filter what gets added to the digest/summary
    + $group_activity_ids = apply_filters(‘ass_digest_record_activity’,$group_activity_ids,$activity_id, $user_id, $group_id, $type );
    +
    // re-save it
    update_usermeta( $user_id, ‘ass_digest_items’, $group_activity_ids );
    }

    `

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Looks good. I’ll add it when I get a chance.

    Avatar of sboisvert
    sboisvert
    Participant

    @sboisvert

    I’m actually now trying to add the same behavior to supersub and sub. I see the ‘ass_this_activity_is_important’ filter, that could be used to mark things as false to make it not send the email. But that doesn’t give me the info I need since I would need the user ID for atleast my purposes.

    I’m wondering if perhaps I should not change the way I was trying to solve this problem by replacing it with something like this inside the subscribed users loop:
    `
    $this_activity_is_important = apply_filters( ‘ass_this_activity_is_important_per_user’, $content->id, $user_id, $group_id, $group_status );
    `

    Sorry for having submitted something that wasn’t 100% thought out. Again I’m not sure if this is the best way, latching onto the existing is_important, but it seems like re-using the current mechanism wouldn’t be such a bad idea. Your thoughts?

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    I’m a bit confused about what you’re trying to do. How do you want to manipulate the digest data? What user-facing change do you want to make?

    `ass_digest_record_activity()` only affects the digests. You may want something a bit further up the chain.

    Avatar of sboisvert
    sboisvert
    Participant

    @sboisvert

    ya you are right, I was attacking this problem all wrong. Basically I wanted to filter which user get which updates based on the language the update is posted in.
    I finally finished with adding this inside the ass_group_notification_activity() function
    `
    $skip = false;
    $skip = apply_filters( ‘ass_skip_group_notification_per_user’, $content->id, $user_id, $group_id, $group_status );
    if ($skip){
    continue;
    }
    `

    I suspect that its not the most optimal way of coding it, it looks bloated for what its doing, but I’m not 100% sure of the standard to represent this type of logic in wordpress. I am open to suggestions. I will send over a svn patch after I’m done everything. I’m also adding
    `
    do_action(‘ass_digest_fire’,$type);
    `
    in ass_digest_fire();
    since I might add a few more things I’ll refrain from sending you some half ass things that I’ll change later (like I did before… my apologies)

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.