Changeset 6310 for trunk/bp-core/bp-core-functions.php
- Timestamp:
- 09/06/2012 04:24:22 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-functions.php
r6259 r6310 911 911 * Are we running multiblog mode? 912 912 * 913 * Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WP Multisite. "Multiblog" is 914 * a BP setup that allows BP content to be viewed in the theme, and with the URL, of every blog 915 * on the network. Thus, instead of having all 'boonebgorges' links go to 913 * Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WordPress 914 * Multisite. "Multiblog" is BuddyPress setup that allows BuddyPress components 915 * to be viewed on every blog on the network, each with their own settings. 916 * 917 * Thus, instead of having all 'boonebgorges' links go to 916 918 * http://example.com/members/boonebgorges 917 * on the root blog, each blog will have its own version of the same profilecontent, eg919 * on the root blog, each blog will have its own version of the same content, eg 918 920 * http://site2.example.com/members/boonebgorges (for subdomains) 919 921 * http://example.com/site2/members/boonebgorges (for subdirectories) 920 922 * 921 * Multiblog mode is disabled by default, meaning that all BP content must be viewed on the root 922 * blog. 923 * Multiblog mode is disabled by default, meaning that all BuddyPress content 924 * must be viewed on the root blog. It's also recommended not to use the 925 * BP_ENABLE_MULTIBLOG constant beyond 1.7, as BuddyPress can now be activated 926 * on individual sites. 927 * 928 * Why would you want to use this? Originally it was intended to allow 929 * BuddyPress to live in mu-plugins and be visible on mapped domains. This is 930 * a very small use-case with large architectural shortcomings, so do not go 931 * down this road unless you specifically need to. 923 932 * 924 933 * @package BuddyPress … … 929 938 */ 930 939 function bp_is_multiblog_mode() { 931 return apply_filters( 'bp_is_multiblog_mode', is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ); 940 941 // Setup some default values 942 $retval = false; 943 $is_multisite = is_multisite(); 944 $network_active = bp_is_network_activated(); 945 $is_multiblog = defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG; 946 947 // Multisite, Network Activated, and Specifically Multiblog 948 if ( $is_multisite && $network_active && $is_multiblog ) { 949 $retval = true; 950 951 // Multisite, but not network activated 952 } elseif ( $is_multisite && ! $network_active ) { 953 $retval = true; 954 } 955 956 return apply_filters( 'bp_is_multiblog_mode', $retval ); 932 957 } 933 958 … … 1077 1102 1078 1103 // Links belong in network admin 1079 if ( bp_core_do_network_admin() ) 1104 if ( bp_core_do_network_admin() ) { 1080 1105 $url = network_admin_url( $path, $scheme ); 1081 1106 1082 1107 // Links belong in site admin 1083 else1108 } else { 1084 1109 $url = admin_url( $path, $scheme ); 1110 } 1085 1111 1086 1112 return $url; 1087 1113 } 1088 1114 1115 /** 1116 * Should BuddyPress appear in network admin, or site admin? 1117 * 1118 * Because BuddyPress can be installed in multiple ways and with multiple 1119 * configurations, we need to check a few things to be confident about where 1120 * to hook into certain areas of WordPress's admin. 1121 * 1122 * This function defaults to BuddyPress being network activated. 1123 * @since BuddyPress (1.5) 1124 * 1125 * @uses bp_is_network_activated() 1126 * @uses bp_is_multiblog_mode() 1127 * @return boolean 1128 */ 1089 1129 function bp_core_do_network_admin() { 1090 $do_network_admin = false; 1091 1092 if ( is_multisite() && !bp_is_multiblog_mode() ) 1093 $do_network_admin = true; 1094 1095 return apply_filters( 'bp_core_do_network_admin', $do_network_admin ); 1130 1131 // Default 1132 $retval = bp_is_network_activated(); 1133 1134 if ( bp_is_multiblog_mode() ) 1135 $retval = false; 1136 1137 return (bool) apply_filters( 'bp_core_do_network_admin', $retval ); 1096 1138 } 1097 1139 … … 1100 1142 1101 1143 return apply_filters( 'bp_core_admin_hook', $hook ); 1144 } 1145 1146 /** 1147 * Is BuddyPress active at the network level for this network? 1148 * 1149 * Used to determine admin menu placement, and where settings and options are 1150 * stored. If you're being *really* clever and manually pulling BuddyPress in 1151 * with an mu-plugin or some other method, you'll want to 1152 * 1153 * @since BuddyPress (1.7) 1154 * @return boolean 1155 */ 1156 function bp_is_network_activated() { 1157 1158 // Default to is_multisite() 1159 $retval = is_multisite(); 1160 1161 // Check the sitewide plugins array 1162 $base = buddypress()->basename; 1163 $plugins = get_site_option( 'active_sitewide_plugins' ); 1164 1165 // Override is_multisite() if not network activated 1166 if ( ! is_array( $plugins ) || ! isset( $plugins[$base] ) ) 1167 $retval = false; 1168 1169 return (bool) apply_filters( 'bp_is_network_activated', $retval ); 1102 1170 } 1103 1171
Note: See TracChangeset
for help on using the changeset viewer.