Beispiel #1
0
function bp_core_confirmation_js() {
	global $current_blog;

	if ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG )
		return false;
?>

	<script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( '<?php _e( 'Are you sure?', 'buddypress' ) ?>' ) ) return true; else return false; }); });</script>

<?php
}
Beispiel #2
0
/**
 * bp_core_avatar_url()
 *
 * Returns the raw base URL for root site upload location
 *
 * @global object $current_blog Current blog information
 * @uses wp_upload_dir To get upload directory info
 * @return string Full URL to current upload location
 */
function bp_core_avatar_url() {
	global $current_blog;

	// Get upload directory information from current site
	$upload_dir = wp_upload_dir();

	// If multisite, and current blog does not match root blog, make adjustments
	if ( bp_core_is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
		$upload_dir['baseurl'] = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' );

	return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] );
}
						<?php 
            }
            ?>
					<?php 
        }
        ?>
				
				<?php 
    }
    ?>
				
				
				<!-- Blogs Sidebar -->
							
				<?php 
    if (bp_is_active('blogs') && bp_core_is_multisite()) {
        ?>
					<?php 
        if (bp_is_page(BP_BLOGS_SLUG)) {
            ?>
							<?php 
            dynamic_sidebar('blogs');
            ?>
					<?php 
        }
        ?>
				<?php 
    }
    ?>
				
				
Beispiel #4
0
function bp_blogs_remove_data( $user_id ) {
	if ( !bp_core_is_multisite() )
		return false;

	/* If this is regular blog, delete all data for that blog. */
	BP_Blogs_Blog::delete_blogs_for_user( $user_id );

	do_action( 'bp_blogs_remove_data', $user_id );
}
Beispiel #5
0
function bp_core_admin_component_setup() {
	global $wpdb, $bp;
?>

	<?php
	if ( isset( $_POST['bp-admin-component-submit'] ) && isset( $_POST['bp_components'] ) ) {
		if ( !check_admin_referer('bp-admin-component-setup') )
			return false;

		// Settings form submitted, now save the settings.
		foreach ( (array)$_POST['bp_components'] as $key => $value ) {
			if ( !(int) $value )
				$disabled[$key] = 1;
		}
		update_site_option( 'bp-deactivated-components', $disabled );
	}
	?>

	<div class="wrap">

		<h2><?php _e( 'BuddyPress Component Setup', 'buddypress' ) ?></h2>

		<?php if ( isset( $_POST['bp-admin-component-submit'] ) ) : ?>
			<div id="message" class="updated fade">
				<p><?php _e( 'Settings Saved', 'buddypress' ) ?></p>
			</div>
		<?php endif; ?>

		<form action="" method="post" id="bp-admin-component-form">

			<p><?php _e('By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form below. Your BuddyPress installation will continue to function, however the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ) ?></p>

			<?php $disabled_components = get_site_option( 'bp-deactivated-components' ); ?>

			<table class="form-table" style="width: 80%">
			<tbody>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-activity.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'Activity Streams', 'buddypress' ) ?></h3><p><?php _e( 'Allow users to post activity updates and track all activity across the entire site.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-activity.php]" value="1"<?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
						<input type="radio" name="bp_components[bp-activity.php]" value="0"<?php if ( isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') && bp_core_is_multisite() ) : ?>
				<tr>
					<td><h3><?php _e( 'Blog Tracking', 'buddypress' ) ?></h3><p><?php _e( 'Tracks blogs, blog posts and blogs comments for a user across a WPMU installation.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-blogs.php]" value="1"<?php if ( !isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-blogs.php]" value="0"<?php if ( isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-forums.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'bbPress Forums', 'buddypress' ) ?></h3><p><?php _e( 'Activates bbPress forum support within BuddyPress groups or any other custom component.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-forums.php]" value="1"<?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-forums.php]" value="0"<?php if ( isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-friends.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'Friends', 'buddypress' ) ?></h3><p><?php _e( 'Allows the creation of friend connections between users.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-friends.php]" value="1"<?php if ( !isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-friends.php]" value="0"<?php if ( isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-groups.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'Groups', 'buddypress' ) ?></h3><p><?php _e( 'Let users create, join and participate in groups.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-groups.php]" value="1"<?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-groups.php]" value="0"<?php if ( isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-messages.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'Private Messaging', 'buddypress' ) ?></h3><p><?php _e( 'Let users send private messages to one another. Site admins can also send site-wide notices.', 'buddypress' ) ?></p></td>
					<td>
						<input type="radio" name="bp_components[bp-messages.php]" value="1"<?php if ( !isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-messages.php]" value="0"<?php if ( isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
				<?php if ( file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') ) : ?>
				<tr>
					<td><h3><?php _e( 'Extended Profiles', 'buddypress' ) ?></h3><p><?php _e( 'Activates customizable profiles and avatars for site users.', 'buddypress' ) ?></p></td>
					<td width="45%">
						<input type="radio" name="bp_components[bp-xprofile.php]" value="1"<?php if ( !isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?>  &nbsp;
						<input type="radio" name="bp_components[bp-xprofile.php]" value="0"<?php if ( isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
					</td>
				</tr>
				<?php endif; ?>
			</tbody>
			</table>

			<p class="submit">
				<input class="button-primary" type="submit" name="bp-admin-component-submit" id="bp-admin-component-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
			</p>

			<?php wp_nonce_field( 'bp-admin-component-setup' ) ?>

		</form>

	</div>

<?php
}
Beispiel #6
0
/**
 * bp_core_login_redirect()
 *
 * When a user logs in, always redirect them back to the previous page. NOT the admin area.
 *
 * @package BuddyPress Core
 */
function bp_core_login_redirect( $redirect_to ) {
	global $bp, $current_blog;

	if ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG )
		return $redirect_to;

	if ( !empty( $_REQUEST['redirect_to'] ) || strpos( $_REQUEST['redirect_to'], 'wp-admin' ) )
		return $redirect_to;

	if ( false === strpos( wp_get_referer(), 'wp-login.php' ) && false === strpos( wp_get_referer(), 'activate' ) && empty( $_REQUEST['nr'] ) )
		return wp_get_referer();

	return $bp->root_domain;
}
/**
 * bp_core_set_uri_globals()
 *
 * Analyzes the URI structure and breaks it down into parts for use in code.
 * The idea is that BuddyPress can use complete custom friendly URI's without the
 * user having to add new re-write rules.
 *
 * Future custom components would then be able to use their own custom URI structure.
 *
 * The URI's are broken down as follows:
 *   - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
 *   - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
 *
 *	Example:
 *    - http://domain.com/members/andy/profile/edit/group/5/
 *    - $bp->current_component: string 'profile'
 *    - $bp->current_action: string 'edit'
 *    - $bp->action_variables: array ['group', 5]
 *
 * @package BuddyPress Core
 */
function bp_core_set_uri_globals()
{
    global $current_component, $current_action, $action_variables;
    global $displayed_user_id;
    global $is_member_page;
    global $bp_unfiltered_uri;
    global $bp, $current_blog;
    // Only catch URI's on the root blog if we are not running BP on multiple blogs
    if (!defined('BP_ENABLE_MULTIBLOG') && bp_core_is_multisite()) {
        if (BP_ROOT_BLOG != (int) $current_blog->blog_id) {
            return false;
        }
    }
    // Ajax or not?
    if (strpos($_SERVER['REQUEST_URI'], 'wp-load.php')) {
        $path = bp_core_referrer();
    } else {
        $path = esc_url($_SERVER['REQUEST_URI']);
    }
    $path = apply_filters('bp_uri', $path);
    // Take GET variables off the URL to avoid problems,
    // they are still registered in the global $_GET variable
    $noget = substr($path, 0, strpos($path, '?'));
    if ($noget != '') {
        $path = $noget;
    }
    // Fetch the current URI and explode each part separated by '/' into an array
    $bp_uri = explode('/', $path);
    // Loop and remove empties
    foreach ((array) $bp_uri as $key => $uri_chunk) {
        if (empty($bp_uri[$key])) {
            unset($bp_uri[$key]);
        }
    }
    // Running off blog other than root
    if (defined('BP_ENABLE_MULTIBLOG') || 1 != BP_ROOT_BLOG) {
        // Any subdirectory names must be removed from $bp_uri.
        // This includes two cases: (1) when WP is installed in a subdirectory,
        // and (2) when BP is running on secondary blog of a subdirectory
        // multisite installation. Phew!
        if ($chunks = explode('/', $current_blog->path)) {
            foreach ($chunks as $key => $chunk) {
                $bkey = array_search($chunk, $bp_uri);
                if ($bkey !== false) {
                    unset($bp_uri[$bkey]);
                }
                $bp_uri = array_values($bp_uri);
            }
        }
    }
    // Set the indexes, these are incresed by one if we are not on a VHOST install
    $component_index = 0;
    $action_index = $component_index + 1;
    // If this is a WordPress page, return from the function.
    if (is_page($bp_uri[$component_index])) {
        return false;
    }
    // Get site path items
    $paths = explode('/', bp_core_get_site_path());
    // Take empties off the end of path
    if (empty($paths[count($paths) - 1])) {
        array_pop($paths);
    }
    // Take empties off the start of path
    if (empty($paths[0])) {
        array_shift($paths);
    }
    foreach ((array) $bp_uri as $key => $uri_chunk) {
        if (in_array($uri_chunk, $paths)) {
            unset($bp_uri[$key]);
        }
    }
    // Reset the keys by merging with an empty array
    $bp_uri = array_merge(array(), $bp_uri);
    $bp_unfiltered_uri = $bp_uri;
    // If we are under anything with a members slug, set the correct globals
    if ($bp_uri[0] == BP_MEMBERS_SLUG) {
        $is_member_page = true;
        $is_root_component = true;
    }
    // Catch a member page and set the current member ID
    if (!defined('BP_ENABLE_ROOT_PROFILES')) {
        if ($bp_uri[0] == BP_MEMBERS_SLUG && !empty($bp_uri[1]) || in_array('wp-load.php', $bp_uri)) {
            // We are within a member page, set up user id globals
            if (defined('BP_ENABLE_USERNAME_COMPATIBILITY_MODE')) {
                $displayed_user_id = bp_core_get_userid(urldecode($bp_uri[1]));
            } else {
                $displayed_user_id = bp_core_get_userid_from_nicename(urldecode($bp_uri[1]));
            }
            unset($bp_uri[0]);
            unset($bp_uri[1]);
            // Reset the keys by merging with an empty array
            $bp_uri = array_merge(array(), $bp_uri);
        }
    } else {
        if (get_userdatabylogin($bp_uri[0]) || in_array('wp-load.php', $bp_uri)) {
            $is_member_page = true;
            $is_root_component = true;
            // We are within a member page, set up user id globals
            if (defined('BP_ENABLE_USERNAME_COMPATIBILITY_MODE')) {
                $displayed_user_id = bp_core_get_userid(urldecode($bp_uri[0]));
            } else {
                $displayed_user_id = bp_core_get_userid_from_nicename(urldecode($bp_uri[0]));
            }
            unset($bp_uri[0]);
            // Reset the keys by merging with an empty array
            $bp_uri = array_merge(array(), $bp_uri);
        }
    }
    if (!isset($is_root_component)) {
        $is_root_component = in_array($bp_uri[0], $bp->root_components);
    }
    if (!is_subdomain_install() && !$is_root_component) {
        $component_index++;
        $action_index++;
    }
    // Set the current component
    $current_component = $bp_uri[$component_index];
    // Set the current action
    $current_action = $bp_uri[$action_index];
    // Set the entire URI as the action variables, we will unset the current_component and action in a second
    $action_variables = $bp_uri;
    // Unset the current_component and action from action_variables
    unset($action_variables[$component_index]);
    unset($action_variables[$action_index]);
    // Remove the username from action variables if this is not a VHOST install
    if (!is_subdomain_install() && !$is_root_component) {
        array_shift($action_variables);
    }
    // Reset the keys by merging with an empty array
    $action_variables = array_merge(array(), $action_variables);
}
Beispiel #8
0
function bp_core_activate_signup( $key ) {
	global $bp, $wpdb;

	$user = false;

	/* Multisite installs have their own activation routine */
	if ( bp_core_is_multisite() ) {
		$user = wpmu_activate_signup( $key );

		/* If there was errors, add a message and redirect */
		if ( $user->errors ) {
			bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' );
			bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG );
		}

		$user_id = $user['user_id'];

		/* Set any profile data */
		if ( function_exists( 'xprofile_set_field_data' ) ) {
			if ( !empty( $user['meta']['profile_field_ids'] ) ) {
				$profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] );

				foreach( (array)$profile_field_ids as $field_id ) {
					$current_field = $user['meta']["field_{$field_id}"];

					if ( !empty( $current_field ) )
						xprofile_set_field_data( $field_id, $user_id, $current_field );
				}
			}
		}

	} else {
		/* Get the user_id based on the $key */
		$user_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'activation_key' AND meta_value = %s", $key ) );

		if ( empty( $user_id ) )
			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );

		/* Change the user's status so they become active */
		if ( !$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) ) )
			return new WP_Error( 'invalid_key', __( 'Invalid activation key', 'buddypress' ) );

		/* Notify the site admin of a new user registration */
		wp_new_user_notification( $user_id );

		/* Remove the activation key meta */
		delete_user_meta( $user_id, 'activation_key' );
	}

	/* Update the user_url and display_name */
	wp_update_user( array( 'ID' => $user_id, 'user_url' => bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), 'display_name' => bp_core_get_user_displayname( $user_id ) ) );

	/* Add a last active entry */
	update_user_meta( $user_id, 'last_activity', bp_core_current_time() );

	/* Set the password on multisite installs */
	if ( bp_core_is_multisite() && !empty( $user['meta']['password'] ) )
		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = %s WHERE ID = %d", $user['meta']['password'], $user_id ) );

	/* Delete the total member cache */
	wp_cache_delete( 'bp_total_member_count', 'bp' );

	do_action( 'bp_core_activated_user', $user_id, $key, $user );

	return $user_id;
}
Beispiel #9
0
$bp_album_count = get_option('tn_blogsmu_featured_bp_album_count');
$uploads = wp_upload_dir();
$bp_album_feat_img = $wpdb->get_results("SELECT * FROM " . $wpdb->base_prefix . "bp_album WHERE privacy = '0' ORDER BY RAND() ASC LIMIT " . $bp_album_count);
if ($bp_album_feat_img) {
    foreach ($bp_album_feat_img as $myalbum) {
        $filename = substr($myalbum->pic_mid_url, strrpos($myalbum->pic_mid_url, '/') + 1);
        $owner_id = $myalbum->owner_id;
        $result = bp_get_root_domain() . '/' . BP_MEMBERS_SLUG . '/' . bp_get_username_by_id($id = $owner_id) . '/' . $bp->album->slug . '/' . $bp->album->single_slug . '/' . $myalbum->id;
        ?>

<a href="<?php 
        echo $result;
        ?>
">
<?php 
        if (bp_core_is_multisite()) {
            ?>
<img title="<?php 
            echo $myalbum->description;
            ?>
" src="<?php 
            echo $uploads['baseurl'] . '/' . $bp->album->slug . '/' . $myalbum->owner_id . '/' . $filename;
            ?>
" />
<?php 
        } else {
            ?>
<img title="<?php 
            echo $myalbum->description;
            ?>
" src="<?php 
Beispiel #10
0
function invite_anyone_bypass_registration_lock()
{
    global $bp;
    if ($bp->current_component != BP_REGISTER_SLUG || $bp->current_action != 'accept-invitation') {
        return;
    }
    if (!($email = urldecode($bp->action_variables[0]))) {
        return;
    }
    if (!($options = get_option('invite_anyone'))) {
        return;
    }
    if (empty($options['bypass_registration_lock']) || $options['bypass_registration_lock'] != 'yes') {
        return;
    }
    if (!($invites = invite_anyone_get_invitations_by_invited_email($email))) {
        return;
    }
    // This is a royal hack until there is a filter on bp_get_signup_allowed()
    if (bp_core_is_multisite()) {
        if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'blog') {
            $bp->site_options['registration'] = 'all';
        } else {
            if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'none') {
                $bp->site_options['registration'] = 'user';
            }
        }
    } else {
        add_filter('option_users_can_register', create_function(false, 'return true;'));
    }
}
Beispiel #11
0
function bp_forums_bbpress_install() {
	global $wpdb, $bbdb, $bp;

	check_admin_referer( 'bp_forums_new_install_init' );

	/* Create the bb-config.php file */
	$initial_write = bp_forums_bbpress_write(
		BP_PLUGIN_DIR . '/bp-forums/bbpress/bb-config-sample.php',
		ABSPATH . 'bb-config.php',
		array(
			"define( 'BBDB_NAME',"  		=> array( "'bbpress'",                     	"'" . DB_NAME . "'" ),
			"define( 'BBDB_USER',"  		=> array( "'username'",                    	"'" . DB_USER . "'" ),
			"define( 'BBDB_PASSWO"  		=> array( "'password'",                    	"'" . DB_PASSWORD . "'" ),
			"define( 'BBDB_HOST',"  		=> array( "'localhost'",                   	"'" . DB_HOST . "'" ),
			"define( 'BBDB_CHARSE"  		=> array( "'utf8'",                        	"'" . DB_CHARSET . "'" ),
			"define( 'BBDB_COLLAT"  		=> array( "''",                            	"'" . DB_COLLATE . "'" ),
			"define( 'BB_AUTH_KEY"  		=> array( "'put your unique phrase here'",  "'" . addslashes( AUTH_KEY ) . "'" ),
			"define( 'BB_SECURE_A"  		=> array( "'put your unique phrase here'",  "'" . addslashes( SECURE_AUTH_KEY ) . "'" ),
			"define( 'BB_LOGGED_I"  		=> array( "'put your unique phrase here'",  "'" . addslashes( LOGGED_IN_KEY ) . "'" ),
			"define( 'BB_NONCE_KE"  		=> array( "'put your unique phrase here'",  "'" . addslashes( NONCE_KEY ) . "'" ),
			"\$bb_table_prefix = '" 		=> array( "'bb_'",                          "'" . $bp->table_prefix . "bb_'" ),
			"define( 'BB_LANG', '" 			=> array( "''",                          	"'" . WPLANG . "'" )
		)
	);

	/* Add the custom user and usermeta entries to the config file */
	if ( $initial_write == 1 ) {
		$file = file_get_contents( ABSPATH . 'bb-config.php' );
	} else {
		$file = &$initial_write;
	}

	$file = substr( $file, 0, -2 );
	$file .= "\n" .   '$bb->custom_user_table = \'' . $wpdb->users . '\';';
	$file .= "\n" .   '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
	$file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . '/bp-forums/bbpress/\';';
	$file .= "\n" .   '$bb->name = \'' . get_blog_option( BP_ROOT_BLOG, 'name' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';

	if ( bp_core_is_multisite() )
		$file .= "\n" .   '$bb->wordpress_mu_primary_blog_id = ' . BP_ROOT_BLOG . ';';

	if ( defined( 'AUTH_SALT' ) )
		$file .= "\n\n" . 'define(\'BB_AUTH_SALT\', \'' . addslashes( AUTH_SALT ) . '\');';

	if ( defined( 'LOGGED_IN_SALT' ) )
		$file .= "\n" .   'define(\'BB_LOGGED_IN_SALT\', \'' . addslashes( LOGGED_IN_SALT ) . '\');';

	if ( defined( 'SECURE_AUTH_SALT' ) )
		$file .= "\n" .   'define(\'BB_SECURE_AUTH_SALT\', \'' . addslashes( SECURE_AUTH_SALT ) . '\');';

	$file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);';
	$file .= "\n\n" . '?>';

	if ( $initial_write == 1 ) {
		$file_handle = fopen( ABSPATH . 'bb-config.php', 'w' );
		fwrite( $file_handle, $file );
		fclose( $file_handle );
	} else {
		$initial_write = $file;
	}

	update_site_option( 'bb-config-location', ABSPATH . 'bb-config.php' );
	return $initial_write;
}
Beispiel #12
0
	function bp_get_blog_signup_allowed() {
		global $bp;

		if ( !bp_core_is_multisite() )
			return false;

		$status = $bp->site_options['registration'];
		if ( 'none' != $status && 'user' != $status )
			return true;

		return false;
	}
Beispiel #13
0
/**
 * bp_core_boot_spammer()
 *
 * When a user logs in, check if they have been marked as a spammer. If yes then simply
 * redirect them to the home page and stop them from logging in.
 *
 * @package BuddyPress Core
 * @param $auth_obj The WP authorization object
 * @param $username The username of the user logging in.
 * @uses get_userdatabylogin() Get the userdata object for a user based on their username
 * @uses bp_core_redirect() Safe redirect to a page
 * @return $auth_obj If the user is not a spammer, return the authorization object
 */
function bp_core_boot_spammer( $auth_obj, $username ) {
	global $bp;

	$user = get_userdatabylogin( $username );

	if ( ( bp_core_is_multisite() && (int)$user->spam ) || 1 == (int)$user->user_status )
		bp_core_redirect( $bp->root_domain );
	else
		return $auth_obj;
}
Beispiel #14
0
function bp_core_get_status_sql( $prefix = false ) {
	if ( !bp_core_is_multisite() )
		return "{$prefix}user_status = 0";
	else
		return "{$prefix}spam = 0 AND {$prefix}deleted = 0 AND {$prefix}user_status = 0";
}