Skip to:

Problem with news feed (activities) filter

  • groston


    I did not develop, but help support, the website. I have stumbled across three issues with the site, but I believe all are closely related.

    Issue 1: The default settings for the News Feed are too inclusive and the News Feed gets clogged with uninteresting stuff. To address this issue, I received some help form this forum which resulted in my adding the following code to …/wp-content/themes/social-portfolio/functions.php. (Yes, this does belong in social-portfolio-child, but when I added it there, it did not function. It would require too much time and effort to address fix this problem, which just means that I have to be careful should we update the theme.)

    function ec_filter_activity( $activity_object ) {
      $activity_object['action'] = array( 'item1', 'item2');
      return $activity_object;
    add_filter( 'bp_after_has_activities_parse_args', 'ec_filter_activity');

    The good news is that this code does limit the items shown in the News Feed to those in the item list. However, the dropdown filter, which allows filtering by activity type, no longer functions. Selecting any value causes the page to refresh, but the items displayed are not changed. Also note that removing the code shown in Issue 2 below does not change this behavior.

    Issue 2: Part of the customization is to allow site members to post portfolios of their work. This was implemented as a custom component called gallery and there are two activities associated with this component. The first thing I did was register these activities (as the developer had failed to do so). Next, I added the following code to …/wp-content/plugins/embrace-creatives/include/components/gallery/gallery-component.php

    function setup_actions() { /*other lines from this function omitted for clarity */
        add_action( 'bp_activity_filter_options', array( $this, 'display_activity_actions' ) );  /* added */
    public function display_activity_actions() {  /* newly added function */
        <option value="<?php echo 'portfolio_published'; ?>"><?php _e('Portfolio Published'); ?></option>
        <option value="<?php echo 'project_published'; ?>"><?php _e('Project Published'); ?></option>
    <?php  }

    The good news is that these two actions are shown in the dropdown mentioned above. However, whereas the dropdown functions properly with regard to all other activities, it does not function for these two newly added ones (when this code is active and the code from Issue 1 is disabled).

    Issue 3: The list of activities shown in the dropdown filter should match the list specified under Issue 1. While I think that I may have figured out how to add activities to this filter (see Issue 2), I do not know how to remove ones on the list, or better yet, simply specify only the ones that should be included.

    We would truly appreciate any assistance you can provide. I would be more than willing to jump onto a phone call or even provide access to our clone site if someone wants to jump in.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar