Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Activity Feed

  • @amahesh

    Member

    Is there a way to make it so ONLY updates from group admin show up in group activity feed?

Viewing 20 replies - 1 through 20 (of 20 total)
  • @r-a-y

    Keymaster

    I’d remove the group feed function so I could create my own group feed loop.

    What you’d want to do is remove the existing one by adding this to your theme’s functions.php:
    remove_action( 'wp', 'groups_action_group_feed', 3 );

    Then I’d basically duplicate the groups_action_group_feed() function (located in /buddypress/bp-groups.php), rename the function, throw it in my theme’s functions.php file and change the pointer of the following file:

    bp-activity/feeds/bp-activity-group-feed.php

    to a custom file I would also create in my theme’s directory.

    Lastly, I would open up this duplicate of bp-activity-group-feed.php and modify the activity loop so it shows updates only from the group admin.

    @amahesh

    Member

    @r-a-y
    what would I put in the custom file?

    @amahesh

    Member

    If I wanted to filter it so just forum posts and topics did not appaear what should I do? I saw the text below at the link you sent but dont really understand what code to edit in the bp-activity-group-feed.php file

    Thanks so much for the help, I’m new to this still and it really helps

    The action type to filter on (can be any active component action as well as custom component actions)
    Example arguments: new_wire_post, new_forum_post, new_blog_comment new_blog_post, friendship_created, joined_group, created_group, new_forum_topic, new_status
    Default value: false (no filter)

    @amahesh

    Member

    any thoughts @r-a-y or anyone else?

    @r-a-y

    Keymaster

    @amahesh

    In your theme’s functions.php, make sure your code looks something like this:
    http://pastebin.com/Pn1jFXG5

    Read the comments in the code.

    Then In your duplicate of bp-activity-group-feed.php, you need to change:

    if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded' ) ) :

    to

    if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&secondary_item_id=' . $bp->groups->current_group->creator_id . 'max=50&display_comments=threaded' ) ) :

    This will filter the group activity feed so only updates from the creator of the group will be listed. If you have multiple admins, you’ll have to find a way to append their IDs (comma-delimited) to the end of the “secondary_item_id” parameter.

    @amahesh

    Member

    @r-a-y

    for this line include_once( WP_CONTENT_DIR . ‘/themes/YOURTHEME/bp-activity-group-feed.php’ );

    shouuld the directory be “plugins/buddypress/bp-themes/bp-default/’ ? Also does it matter that i am running it on snipbids.com/network and not snipbids.com?

    Which functions.php file do I edit? The bp-default one correct? So I add the code you sent there and edit the line above?

    Do I edit bp-activity-group-feed.php or make a copy of it and put it in my bp-defualt folder and make the edits there and keep the original?

    I got an error and my whole site went down so i reverted to the original

    Thanks

    @r-a-y

    Keymaster

    @amahesh

    You shouldn’t be modifying any files in /plugins/buddypress.

    If you’re modifying the bp-default theme, build a child theme. That way, when you upgrade BP, your changes will not be wiped out!

    Once you build your child theme, follow the instructions I outlined above.

    And yes, you make a duplicate of bp-activity-group-feed.php and put it in your theme’s folder because we don’t want to modify any core files!

    @amahesh

    Member

    @r-a-y

    I built a child theme, creating the style.css as shown in that link and it built fine
    then I created functions.php and added the code below (does the fact that it is installed on snipbids.com/network have any impact)
    I then made a duplicate of bp-activity-groups-feed.php and put it in the child theme folder and made the edits

    however it did not work the code in my functions.php site shows in the header…see: http://www.snipbids.com/network

    Any ideas why? Thanks. My functions.php file

    // remove the current group activity feed
    remove_action( ‘wp’, ‘groups_action_group_feed’, 3 );

    function my_groups_action_group_feed() {
    global $bp, $wp_query;

    if ( !bp_is_active( ‘activity’ ) || $bp->current_component != $bp->groups->slug || !$bp->groups->current_group || $bp->current_action != ‘feed’ )
    return false;

    $wp_query->is_404 = false;
    status_header( 200 );

    if ( ‘public’ != $bp->groups->current_group->status ) {
    if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
    return false;
    }

    // you should copy /buddypress/bp-activity/feeds/bp-activity-group-feed.php to your theme
    // adjust YOURTHEME to the name of your theme’s directory name
    include_once( WP_CONTENT_DIR . ‘/themes/dusk/bp-activity-group-feed.php’ );
    die;
    }
    add_action( ‘wp’, ‘my_groups_action_group_feed’, 3 );

    @r-a-y

    Keymaster

    @amahesh – You need to wrap the code in functions.php with open and closing PHP tags.
    eg.

    [?php

    THE PHP CODE

    ?]

    Replace square brackets with triangular ones.

    @dwenaus

    Participant

    i solved this with a child theme by copying activity.php from the default theme to my child theme in the same folder structure (group/single/activity.php) then totally redoing the whole thing. This is using wordpress built in template replacement. good o’l wordpress.

    Now I’ve got recent forum posts on the left with activity feed on the right. and the post update box at the bottom. I put them at the bottom because I wanted people to use the discussion forum more than posting updates.

    here is the new improved group home page: http://shambhalanetwork.org/groups/beta-phase-discussion-group/

    @r-a-y

    Keymaster

    After re-reading the first post again, I don’t think amahesh wanted to override the group activity RSS feed like I originally thought! lol
    That’s what happens when you read into things too literally!

    amahesh, if you’re talking about just filtering the main group home activity, then you’ll need to modify the AJAX $query_string:
    https://buddypress.org/forums/topic/how-can-i-set-show-newblogposts-as-default-on-acitivity-stream

    Detect if you’re on the group’s home page, then you’ll need to add the secondary_item_id that I talked about above.

    Or you can do what dwenaus did and create your own group activity template.

    @amahesh

    Member

    Hello @r-a-y…yes all I want to do is filter the main group home activity of every group so that only updates from the admin show, not everyone and not forum posts…I looked over the link and was confused as to what to do

    Thanks for taking so much time to help me out but if you could please just let me know where the AJAX $query_string is and what exactly I need to modify it I would greatly greatly appreciate it

    Thanks

    @amahesh

    Member

    I figured out what I want to do…I want to make it so the default is the “Show Updates” section instead of the no filters suggestion. Any help would be greatly appreciated

    Tahnks
    @r-a-y

    @amahesh

    Member

    The code in that link you sent me r-ay does it for profiles…how can I edit it so it does it for group activity

    @amahesh

    Member

    @r-a-y or anyone else have any suggestions?

    @r-a-y

    Keymaster

    You have to modify the code from that other post to work for groups.

    Use a conditional like bp_is_group_home(), then modify the query string to add the “user_id” parameter for the group admin.
    http://pastebin.com/Fv5kPuBk

    Modify to your liking.

    @amahesh

    Member

    THANK YOU SO MUCH…it works perfectly! :)

    @amahesh

    Member

    hello @r-a-y, this seems to be hiding new joined groups on the home page, but not in the activity pages of the people who have joined the groups

    @amahesh

    Member

    alternativelt i would be fine by getting rid of the “user has joined group” activity update all together

    Tahns

    @r-a-y

    Keymaster

    For the alternative method, use Rich’s block activity types plugin:
    https://wordpress.org/extend/plugins/buddypress-block-activity-stream-types/

Viewing 20 replies - 1 through 20 (of 20 total)
  • The topic ‘Group Activity Feed’ is closed to new replies.
Skip to toolbar