Here is the use case:
You want to show activity across the entire site (/activity) but you don't want to show node/comment delete activity...Let's say you are cleaning house in a nasty forum thread or removing spam posts with dodgy node titles...it would be nice to not have those particular posts appear on the activity list.
So there are two things to accomplish here.
First is to extend the activity_get_activity() function to accept negative filters. Right now if you pass in a filter parameter it allows for the creation of an WHERE foo IN ('bar', 'baz') clause for multiple values or WHERE foo = 'bar' clause for single value. If you can include a flag to indicate if negation is desired then we could include the case of a NOT IN clause or != clause.
Second is to allow for the activity_page() function to allow for some or all of the parameters used in the activity_get_activity() function call to be set via the activity admin settings page. In addition to the above mentioned filters suggestion, I may want to set the LIMIT number to 50 instead of 20 or perhaps have a set array of uids to find activity for.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | activity.module.227846.patch | 1.65 KB | jaydub |
| #2 | activity.module.227846.patch | 1.42 KB | jaydub |
Comments
Comment #1
sirkitree commentedJaydub,
I really like this idea and have run across this scenario myself a few times. I end up taking the short-cut and just removing the entry from the activity table as they've only been piecemeal cases. But this sounds like a great way to handle this problem.
I'm pretty swamped with other things right now so I've no time to really try to hash this out right now, maybe after DrupalCon, but if you hack anything up, please submit it. I'd love to see it and would happily spend a little time reviewing.
Comment #2
jaydub commentedHere's a quick pass at adding this in. Let me know what you think.
Comment #3
bcn commented+1 to the feature, and thanks for the module!
Patch no longer applies cleanly to the latest version (v 1.1.2.2.2.26 ).
Comment #4
jaydub commentedre-rolled
Comment #5
bcn commentedNew patch (#4) applies cleanly, but I haven't had time to test yet. Will try to test this out in the next few days.
Comment #6
jdelaune commentedCare to give a few real life examples of how this will work? I could probably work it out if I studied the code long enough, but if you pointed me in the right direction it would cut some time out.
Cheers,
~Jordan
Comment #7
jaydub commentedI've committed the patch to CVS. The basic idea behind the
patch was to allow for negative filters in activity_get_activity
as it was only possible to filter for inclusion previously.
Here are a few examples of how you can use the filters
to generate your own list of activity
The updated docs for the activity_get_activity function
explain the basic idea:
So let's say I want to get activity for nodeactivity but only for the story node type:
I have two filters and both are positive or include filters.
Instead let's say I want to get nodeactivity but get all node types except for page:
Here we have one positive filter and one negative filter.
Let's use an array of node types and introduce a filter on
the operation:
I've include code to attempt to rewrite existing filters to use
the new include/exclude key but if anyone who tries out the
development snapshots can try out their old filters please let
me know if there are problems.
Comment #8
minesota commentedSay, for example I want to exclude 'image' or 'usernode', how / where I write these in the above ?
Writing 'image' in place of 'NOT IN' does not give result.
Comment #9
jaydub commentedThe steps in #7 are not helping?
Comment #10
minesota commentedYes they are helping now. Thanks.
Comment #11
minesota commentedComment #12
jaydub commentedJust need to document this on the handbook pages.
Comment #13
sirkitree commentedclosing. 1.x no longer supported.