Support » Plugin: BuddyPress Activity Filter » Hide Activity Filter is Not Working

  • Resolved vantra117

    (@vantra117)


    Hi, the filter is working for most but not all. The “Show New Group Documents” and “Show Group Document Edits” did not get hidden on the front end even though they were selected on the backend. This filter comes from the BuddyPress Group Documents plugin. Please check.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Varun Dubey

    (@vapvarun)

    @vantra117 Sorry for delayed response, we will check it and provide a solution for it shortly.

    Plugin Contributor Varun Dubey

    (@vapvarun)

    Hi @vantra117, Group document plugin is adding their filter with a different approach, not using BuddyPress actions. It will need to remove their actions and create it with BuddyPress approach. You can add following codes inside child theme functions.php to get it working.

    $dropdowns = array();
    $dropdowns = apply_filters('bp_group_documents_activity_filter_locations', array(
    	'bp_activity_filter_options',
    	'bp_group_activity_filter_options',
    	'bp_member_activity_filter_options'
    ));
    foreach ($dropdowns as $hook) {
    	remove_action($hook, 'bp_group_documents_activity_filter_options');
    }
    
    foreach ($dropdowns as $hook) {
    	add_action($hook, 'filter_bp_group_documents_activity_filter_options');
    }
    
    function filter_bp_group_documents_activity_filter_options() {
    	$bp = buddypress();
    	$filters_db = bp_get_option('bp-hidden-filters-name');
    	$defult_activity_stream = bp_get_option('bp-default-filter-name');
    	$nav_page_name = get_option('bp_group_documents_nav_page_name');
    	$name = !empty($nav_page_name) ? $nav_page_name : __( 'Documents', 'bp-group-documents' );
    	if( is_array( $filters_db ) && !empty( $filters_db ) ) {
    		if( in_array( 'added_group_document' , $filters_db ) && in_array( 'edited_group_document' , $filters_db ) ) {
    		} else {
    			if( in_array( 'added_group_document' , $filters_db ) ) { ?>
    			<option value="edited_group_document" <?php selected( $defult_activity_stream, 'edited_group_document'); ?>><?php printf(__('Show Group %s Edits', 'bp-group-documents'), $name); ?></option>
    			<?php }
    			if( in_array( 'edited_group_document' , $filters_db ) ) { ?>
    			<option value="added_group_document" <?php selected( $defult_activity_stream, 'added_group_document'); ?>><?php printf(__('Show New Group %s', 'bp-group-documents'), $name); ?>
    			</option>
    			<?php }
    		}
    	} else { ?>
    		<option value="added_group_document" <?php selected( $defult_activity_stream, 'added_group_document'); ?>><?php printf(__('Show New Group %s', 'bp-group-documents'), $name); ?>
    		</option>
    		<option value="edited_group_document" <?php selected( $defult_activity_stream, 'edited_group_document'); ?>><?php printf(__('Show Group %s Edits', 'bp-group-documents'), $name); ?></option>
    	<?php }
    }

    Thank you, Vapvarun. It works. Appreciate the help.

    Plugin Contributor Varun Dubey

    (@vapvarun)

    Welcome 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide Activity Filter is Not Working’ is closed to new replies.