Skip to:
Content

BuddyPress.org

Ticket #4429: 4229.01.patch

File 4229.01.patch, 2.2 KB (added by boonebgorges, 11 years ago)
  • bp-activity/bp-activity-template.php

    diff --git bp-activity/bp-activity-template.php bp-activity/bp-activity-template.php
    index 4a6577c..552401a 100644
    function bp_activity_type() { 
    868868        function bp_get_activity_action_name() { return bp_get_activity_type(); }
    869869
    870870/**
     871 * Outputs the activity component
     872 *
     873 * @since BuddyPress (1.7)
     874 *
     875 * @uses bp_get_activity_component()
     876 */
     877function bp_activity_component() {
     878        echo bp_get_activity_component();
     879}
     880        /**
     881         * Returns the component of the current activity item
     882         *
     883         * @since BuddyPress (1.7)
     884         *
     885         * @global object $activities_template {@link BP_Activity_Template}
     886         * @uses apply_filters() Filter 'bp_get_activity_component' to modify
     887         *
     888         * @return string The component of the current activity
     889         */
     890        function bp_get_activity_component() {
     891                global $activities_template;
     892
     893                $component = false;
     894
     895                if ( isset( $activities_template->activity->component ) ) {
     896                        $component = $activities_template->activity->component;
     897                }
     898
     899                return apply_filters( 'bp_get_activity_component', $component );
     900        }
     901
     902/**
    871903 * Outputs the activity user id
    872904 *
    873905 * @since BuddyPress (1.1)
  • bp-groups/bp-groups-filters.php

    diff --git bp-groups/bp-groups-filters.php bp-groups/bp-groups-filters.php
    index 08b9040..9ef0847 100644
    function groups_filter_forums_root_page_sql( $sql ) { 
    169169        return apply_filters( 'groups_filter_bbpress_root_page_sql', 't.topic_id' );
    170170}
    171171add_filter( 'get_latest_topics_fields', 'groups_filter_forums_root_page_sql' );
     172
     173/**
     174 * Keep blocked group members from replying to activity items in that group
     175 *
     176 * @since BuddyPress (1.7)
     177 *
     178 * @param bool $can_comment
     179 * @return bool
     180 */
     181function bp_groups_activity_can_comment( $can_comment ) {
     182        if ( buddypress()->groups->id == bp_get_activity_component() &&
     183             is_user_logged_in() &&
     184             ! current_user_can( 'bp_moderate' ) &&
     185             groups_is_user_banned( bp_loggedin_user_id(), bp_get_activity_item_id() )
     186           ) {
     187                $can_comment = false;
     188        }
     189
     190        return $can_comment;
     191}
     192add_filter( 'bp_activity_can_comment', 'bp_groups_activity_can_comment' );