Created
February 4, 2014 19:45
-
-
Save r-a-y/8810890 to your computer and use it in GitHub Desktop.
Fix bbPress' bbp_is_site_public() function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: bbPress - Fix Site Public function | |
Description: Hotfix for bbPress' bbp_is_site_public() function. | |
Version: 0.1 | |
Author: r-a-y | |
Author URI: http://profiles.wordpress.org/r-a-y | |
*/ | |
/** | |
* Fix bbPress' bbp_is_site_public() function. | |
* | |
* This notably fixes BP activity entries from being posted if the site is not public. | |
*/ | |
function ray_bbp_fix_site_public_function( $retval, $site_id ) { | |
// $retval is numeric, but it needs to be cast as a boolean for | |
// bbp_is_site_public() to work as intended. | |
if ( $retval > 0 ) { | |
$retval = true; | |
} else { | |
$retval = false; | |
} | |
return $retval; | |
} | |
add_filter( 'bbp_is_site_public', 'ray_bbp_fix_site_public_function', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment