Skip to:
Content

BuddyPress.org

Ticket #1971: bp-loader.php

File bp-loader.php, 3.3 KB (added by bueltge, 16 years ago)

bp-loader.php

Line 
1<?php
2/*
3Plugin Name: BuddyPress
4Plugin URI: http://buddypress.org/download/
5Description: BuddyPress will add social networking features to a new or existing WordPress MU installation.
6Author: The BuddyPress Community
7Version: 1.2-rc3
8Author URI: http://buddypress.org/developers/
9Network: true
10*/
11
12define( 'BP_VERSION', '1.2-rc3' );
13
14/***
15 * This file will load in each BuddyPress component based on which
16 * of the components have been activated on the "BuddyPress" admin menu.
17 */
18
19require_once( WP_PLUGIN_DIR . '/buddypress/bp-core.php' );
20$bp_deactivated = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
21
22do_action( 'bp_core_loaded' );
23
24/* Activity Streams */
25if ( !isset( $bp_deactivated['bp-activity.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-activity.php') )
26 include( BP_PLUGIN_DIR . '/bp-activity.php' );
27
28/* Blog Tracking */
29if ( !isset( $bp_deactivated['bp-blogs.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') )
30 include( BP_PLUGIN_DIR . '/bp-blogs.php' );
31
32/* bbPress Forum Integration */
33if ( !isset( $bp_deactivated['bp-forums.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-forums.php') )
34 include( BP_PLUGIN_DIR . '/bp-forums.php' );
35
36/* Friend Connections */
37if ( !isset( $bp_deactivated['bp-friends.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-friends.php') )
38 include( BP_PLUGIN_DIR . '/bp-friends.php' );
39
40/* Groups Support */
41if ( !isset( $bp_deactivated['bp-groups.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-groups.php') )
42 include( BP_PLUGIN_DIR . '/bp-groups.php' );
43
44/* Private Messaging */
45if ( !isset( $bp_deactivated['bp-messages.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-messages.php') )
46 include( BP_PLUGIN_DIR . '/bp-messages.php' );
47
48/* Extended Profiles */
49if ( !isset( $bp_deactivated['bp-xprofile.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') )
50 include( BP_PLUGIN_DIR . '/bp-xprofile.php' );
51
52/* Allow dependent plugins to hook into BuddyPress in a safe way */
53function bp_loaded() {
54 do_action( 'bp_init' );
55}
56add_action( 'plugins_loaded', 'bp_loaded' );
57
58/* Activation Function */
59function bp_loader_activate() {
60 /* Force refresh theme roots. */
61 delete_site_transient( 'theme_roots' );
62
63 /* Switch the user to the new bp-default if they are using the old bp-default on activation. */
64 if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) )
65 switch_theme( 'bp-default', 'bp-default' );
66
67 do_action( 'bp_loader_activate' );
68}
69register_activation_hook( 'buddypress/bp-loader.php', 'bp_loader_activate' );
70
71/* Deactivation Function */
72function bp_loader_deactivate() {
73 if ( !function_exists( 'delete_site_option') )
74 return false;
75
76 delete_site_option( 'bp-core-db-version' );
77 delete_site_option( 'bp-activity-db-version' );
78 delete_site_option( 'bp-blogs-db-version' );
79 delete_site_option( 'bp-friends-db-version' );
80 delete_site_option( 'bp-groups-db-version' );
81 delete_site_option( 'bp-messages-db-version' );
82 delete_site_option( 'bp-xprofile-db-version' );
83 delete_site_option( 'bp-deactivated-components' );
84 delete_site_option( 'bp-blogs-first-install' );
85
86 do_action( 'bp_loader_deactivate' );
87}
88register_deactivation_hook( 'buddypress/bp-loader.php', 'bp_loader_deactivate' );
89
90?>