• Hi Robin,

    Your plugins are always great.

    I noticed when I restrict access to a forum to a group while using Buddypress, the topic still post in the buddypress activity feed.

    Is there a way to have it restrict this creation IF the forum has a restriction?

    Thanks as always.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Robin W

    (@robin-w)

    is this something new, ie did it used to work, or is just something you have found, so don’t know?

    Thread Starter erich199

    (@erich199)

    I noticed it when I was restricting a forum to a staff group.
    Since the topics of nature would be sensitive, I checked the buddypress activity feed and noticed that an entry was still being created and visible to any group.
    I was able to get around this by writing a function that disabled any activity feed post if the forum was set to hidden/private.
    So I would restrict the forum to the staff group and set that forum to hidden and when a new topic was created, no new buddypress activity feed entry was created either.

    Plugin Author Robin W

    (@robin-w)

    thanks, can you share the code here please

    Thread Starter erich199

    (@erich199)

    This is the code I used. I did very little testing with it but from what I did test, if I set the forum to hidden/private then it would not post a buddypress activity. This works for what I need – which is a private forum restricted with private groups

    function disable_bp_activity_for_hidden_private_forums($topic_id) {
    $forum_id = bbp_get_topic_forum_id($topic_id);

    $forum_visibility = bbp_get_forum_visibility($forum_id);

    if ($forum_visibility === 'hidden' || $forum_visibility === 'private') {
    $activity_id = bp_activity_get_activity_id(array(
    'component' => 'bbpress',
    'type' => 'bbp_topic_create',
    'item_id' => $topic_id,
    ));

    if (!empty($activity_id)) {
    bp_activity_delete_by_activity_id($activity_id);
    }
    }
    }
    add_action('bbp_new_topic', 'disable_bp_activity_for_hidden_private_forums', 10, 1);
    Plugin Author Robin W

    (@robin-w)

    thanks, I’ll look at this when I get back from holiday and see if I can fix

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.