anyone on how to customise the loop to include public group activities to the main stream?
@psycolor: public group activities (e.g. joining a group, creating a group, posting updates) should appear in the standard activity stream. Which activities are not showing for you?
To hide private group activity from the activity stream – follow the instructions I gave for excluding blogs in this thread: https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/need-exclude-parameter-for-bp_has_activities/
Check whether the activity item action is group related, then use the primary id of the item to get the group_id, and then check whether it is one of your private groups.
As per my comment on blogs, you can do this for all activity loops by using the filter, or on a loop by loop basis.
Roger, thanks. i did look at this very document, but when i went to figure out where to define the additional filter i got a bit lost…
is there any document which is explaining in a bit more details which activities are included in the loop and which are not in the default theme and help to understand things?
as far as i can understand there are three files involved: the entry.php, the activity-loop.php and the bp-activity-templatetags.php, but, like in other places it is advised not to change the default theme, i’m trying to figure out 1) where to make changes and 2) how to achieve it without breaking anything. that’s why a couple of examples beyond what is in the codex would be particularly useful.
@psycolor –
where to make changes, really depends on your theme setup.
If you want a theme similar to the default, but with your own enhancements (such as the ones in this thread), you are best to create a child theme, and make the changes in there. You’ll be editing the activity-loop.php and entry.php files in your child theme.
Have a look in the documentation for the article on creating child themes.
I don’t know whether there are many examples on line of alternative activity loops. I posted one example earlier today of some amends we’d done to entry.php to access and enhance the activity template tags: https://buddypress.org/community/groups/requests-feedback/forum/topic/omit-time-stamps-from-activityfeed-so-only-date-stamps-show
And here’s an example of how we do a custom blog loop from a site I’m working on at the moment:
`
<?php $args = array (
‘action’ => ‘new_blog_post’,
‘max’ => 20); ?>
<?php $count=0;
while (bp_activities() && ($count < ) : bp_the_activity(); ?>
<?php $blog_id = bp_get_activity_item_id();
if ((int)$blog_id == 1) continue; ?>
<li class="<?php if ($count “>
`
Hi Roger (and everyone else!), i think i’m going somewhere now, but will need some extra input. hopefully the thread will be an additional useful example!
ok, this is where i am at: default theme with the ajax controllers at the top of the activity stream. in the activity folder of the child theme i have an index.php and activity-loop.php and and entry.php.
basically i’ve got a ‘private’ area with content accessible only to staff. for normal post/pages i have is an extra check based on a custom field for posts and the category for pages like the following and then based on the group membership i either show a message or the actual content:
http://pastebin.com/E4cnkwZS (top)
now, because the group is private, the BP stuff is not showing in the activity stream already, which is good, but the posts/pages bypass my checks and come up in the list of activities showing the actual content which should be private instead.
so, here is what i came up with so far. using the index.php i check the group membership and then load two different activity-loops:
http://pastebin.com/E4cnkwZS (bottom)
how would you exclude stuff? in the bp_has_activity function there is an ‘include’ option which allows to filter content, but not an ‘exclude’ one. it might be trivial to go around it, but not sure how. furthermore if you use the dropdown filter i have the impression that the arguments are passed dynamically resetting whatever is passed in the original query (like in your example and some i’ve tried using the same model).
i would very much appreciate any further suggestion! thanks
@psycolor: I gave you a couple of pointers in this thread on how to exclude activities: https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/need-exclude-parameter-for-bp_has_activities/
To include your code in a thread (it’s not showing above), you need to use backticks at the start and end: ` … code … `
i added a link because i tried quotes ‘ ‘, backticks `, dots, and unless i’m going stupid everything is stripping off the php tag at the start of the line: you managed to do it but i can’t seem to display the full code in the post (it is in the message though, which is quite interesting)
i’m afraid that for a non-programmer, or someone who can ‘chew’ some simple code, what you mentioned in the post makes sense in principle, but coding in php it’s at a different story… as i said i managed some conditional stuff in the single page/post and occasionally i used some functions in the template functions.php, but this was also why i was asking about practical examples to understand the mechanic of things.[code] and unless i'm going stupid everything is stripping off the php tag at the start of the line: you managed to do it but i can't seem to display the full code in the post (it is in the message though, which is quite interesting)
i'm afraid that for a non-programmer, or someone who can 'chew' some simple code, what you mentioned in the post makes sense in principle, but coding in php it's at a different story... as i said i managed some conditional stuff in the single page/post and occasionally i used some functions in the template functions.php, but this was also why i was asking about practical examples to understand the mechanic of things.