Filtering the opt-out Authors

Version 7.0 of Subscribe2 introduced a new feature where Registered Subscribers could opt-out of receiving notifications from specific authors on multi-author sites.

Version 8.0 has improved on this a little by allowing site administrators to use a filter to trim down the list so unused author accounts can be removed from the list. To do this you simply code a small plugin extension something like this:

// 's2_authors' is the names of the new filter
add_filter('s2_authors', 'remove_author');
function remove_author($authors) {
	// our function takes an array of author objects as the input
	// you can then cycle through the array and remove any that you like on either 'ID' or 'display_name'
	$i = 0;
	foreach ( $authors as $author ) {
		// example use an if statement to check if author ID should be removed compared to a known ID
		if ( $author->ID == 1 ) {
			unset($authors[$i]);
		}
		$i++;
	}
	return $authors;
}