Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/08/2011 12:55:08 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Introduce bbp_is_site_public() function, and use it to prevent BuddyPress activity stream additions for new topics and replies if entire site is private.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-common-template.php

    r3386 r3398  
    3636
    3737/** is_ ***********************************************************************/
     38
     39/**
     40 * Check if current site is public
     41 *
     42 * @since bbPress (r3398)
     43 *
     44 * @global WPDB $wpdb
     45 * @param int $site_id
     46 * @return bool True if site is public, false if private
     47 */
     48function bbp_is_site_public( $site_id = 0 ) {
     49
     50    // Get the current site ID
     51    if ( empty( $site_id ) ) {
     52        global $wpdb;
     53
     54        $site_id = (int) $wpdb->blogid;
     55    }
     56
     57    // Get the site visibility setting
     58    $public = get_blog_option( $site_id, 'blog_public', 1 );
     59
     60    return (bool) apply_filters( 'bbp_is_site_public', $public, $site_id );
     61}
    3862
    3963/**
Note: See TracChangeset for help on using the changeset viewer.