Skip to:
Content
Pages
Categories
Search
Top
Bottom

Exclude from blogs and members list

  • @infoknutsford-softwarecouk

    Participant

    How do you exclude anyone with the role Subscribers from the blogs list?

    This works in functions.php for the members list

    add_action('bp_ajax_querystring','bpdev_exclude_users', 20, 2 );
    
    function bpdev_exclude_users($qs=false,$object=false){
    
     	if ($object != 'members') {		
     		return $qs;
    	}
    	
    	$subscribers = get_users('role=subscriber');
    		
    	$exclude = "";
    	foreach ($subscribers as $subscriber) {
    		if (trim($exclude) != "") {
    			$exclude = $exclude . ",";
    		}
    		$exclude = $exclude . $subscriber -> ID;
    	}
    	
    	$args['exclude'] = $exclude; 	
     	$qs = build_query($args);
     return $qs;
     
    }

    but changing

    if ($object != 'members') {

    to

    if ($object != 'members' & $object != 'blogs') {

    doesn’t work for the blogs list. I presume the exclude values are wrong and it shouldn’t be the ID but what should it be blogs

    Also how do change the count of Members where it says ALL Members on the registered members page as that still includes Subscribers. Thanks

  • The topic ‘Exclude from blogs and members list’ is closed to new replies.
Skip to toolbar