Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • Pamela
    Participant

    @infoknutsford-softwarecouk

    I agree it should do but as you see it doesn’t unless something else later on is amending the exclude


    Pamela
    Participant

    @infoknutsford-softwarecouk

    I already have this bit of code

    
    add_action('bp_ajax_querystring','bpdev_exclude_users', 20, 2 );
    
    function bpdev_exclude_users($qs=false,$object=false){
    	global $count_of_excluded_members;
    	global $count_of_included_members;
    	$count_of_excluded_members = 0;
    	
     	if ($object != 'members') {		
     		return $qs;
    	}
    	
    	$subscribers = get_users('role=subscriber');
    		
    	$exclude = "";
    	foreach ($subscribers as $subscriber) {		
    		if (trim($exclude) != "") {
    			$exclude = $exclude . ",";			
    		}		
    		$exclude = $exclude . $subscriber -> ID;
    		$count_of_excluded_members++;
    				
    	}
    	$administrators = get_users('role=administrator');
    	foreach ($administrators as $administrator) {		
    		if (trim($exclude) != "") {
    			$exclude = $exclude . ",";			
    		}		
    		$exclude = $exclude . $administrator -> ID;		
    		$count_of_excluded_members++;				
    	}
    	$count_of_included_members = 0;
    	$editors = get_users('role=editor');
    	foreach ($editors as $editor) {
    		$count_of_included_members++;				
    	}
    	$contributors = get_users('role=contributor');
    	foreach ($contributors as $contributor) {
    		$count_of_included_members++;				
    	}	
    	$args = wp_parse_args($qs);
    	$args['exclude'] = $exclude; 
    		
     	$qs = build_query($args);		
     return $qs;
     
    }
    

    Which puts 1 in the exclude list and it goes through there so it doesn’t make sense to me


    Pamela
    Participant

    @infoknutsford-softwarecouk

    OOps it is now working. I had missed out $args = wp_parse_args($qs); when doing the exclude for the subscriber role


    Pamela
    Participant

    @infoknutsford-softwarecouk

    I have now added my own to functions.php which shows the correct counts but the links still don’t work and I have no idea why. When you click on them it always come up with page 1

    
    function members_pagination_count() {
    		echo get_members_pagination_count();
    	}
    	
    	function get_members_pagination_count() {
    		global $members_template;
    		global $count_of_excluded_members;
    		if ( empty( $members_template->type ) )
    			$members_template->type = '';
    		$page_arg = "upage";
    		$page_number = 1;
    		$per_page = 20;
    		$pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
    		$pag_num  = !empty( $_REQUEST['num'] )   ? intval( $_REQUEST['num'] )   : (int) $per_page;
    		$start_num = intval( ( $pag_page - 1 ) * $pag_num ) + 1;
    		$from_num  = bp_core_number_format( $start_num );
    		$to_num    = bp_core_number_format( ( $start_num + ( $pag_num - 1 ) > ($members_template->total_member_count - $count_of_excluded_members) ) ? ($members_template->total_member_count - $count_of_excluded_members) : $start_num + ( $pag_num - 1 ) );		
    		$total     = bp_core_number_format( $members_template->total_member_count - $count_of_excluded_members );
    
    		if ( 'active' == $members_template->type )
    			$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s active member)', 'Viewing member %1$s to %2$s (of %3$s active members)', $total, 'buddypress' ), $from_num, $to_num, $total );
    		else if ( 'popular' == $members_template->type )
    			$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member with friends)', 'Viewing member %1$s to %2$s (of %3$s members with friends)', $total, 'buddypress' ), $from_num, $to_num, $total );
    		else if ( 'online' == $members_template->type )
    			$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member online)', 'Viewing member %1$s to %2$s (of %3$s members online)', $total, 'buddypress' ), $from_num, $to_num, $total );
    		else
    			$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member)', 'Viewing member %1$s to %2$s (of %3$s members)', $total, 'buddypress' ), $from_num, $to_num, $total );
    
    		return apply_filters( 'members_pagination_count', $pag );
    	}
    	
    	function members_pagination_links() {
    		echo get_members_pagination_links();
    	}
    	
    	function get_members_pagination_links() {
    		global $members_template;
    		$page_arg = "upage";
    		$page_number = 1;
    		$per_page = 20;
    		$pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
    		
    		$pag_num  = !empty( $_REQUEST['num'] )   ? intval( $_REQUEST['num'] )   : (int) $per_page;
    		$pag_links = paginate_links( array(
    				'base'      => add_query_arg( $page_arg, '%#%' ),
    				'format'    => '',
    				'total'     => ceil( ((int) $members_template->total_member_count - (int)$count_of_excluded_members) / (int) $pag_num ),
    				'current'   => (int) $pag_page,
    				'prev_text' => _x( '←', 'Member pagination previous text', 'buddypress' ),
    				'next_text' => _x( '→', 'Member pagination next text', 'buddypress' ),
    				'mid_size'   => 1
    			) );
    
    		return apply_filters( 'get_members_pagination_links', $pag_links );
    	}
    

    This is the page

    http://www.ibsregister.com/members/

    They look OK and I haven’t seen any JavaScript errors


    Pamela
    Participant

    @infoknutsford-softwarecouk

    Sorry my First time with BuddyPress. It is the directory plugin – directory/ui-front/buddypress/members/single/directory/listings.php plus a couple of listings in directory/ui-front/general

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar