Changeset 5885
- Timestamp:
- 03/05/2012 06:17:43 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-functions.php
r5749 r5885 360 360 ); 361 361 362 // If forums component is active ,add additional tab363 if ( bp_is_active( 'forums' ) ) {362 // If forums component is active and bbPress 1.x is in use add additional tab 363 if ( bp_is_active( 'forums' ) && bp_forums_is_repair() ) { 364 364 $tabs['3'] = array( 365 365 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup' ), 'admin.php' ) ), -
trunk/bp-core/admin/bp-core-settings.php
r5883 r5885 16 16 * @since BuddyPress (r2786) 17 17 */ 18 function bp_admin_setting_callback_main_section() { 19 ?> 20 21 <p><?php _e( 'Main community settings for enabling features and setting time limits', 'buddypress' ); ?></p> 22 23 <?php 24 } 18 function bp_admin_setting_callback_main_section() { } 19 20 /** 21 * Throttle setting field 22 * 23 * @since BuddyPress (r2737) 24 * 25 * @uses bp_form_option() To output the option value 26 */ 27 function bp_admin_setting_callback_admin_bar() { 28 ?> 29 30 <input id="hide-loggedout-adminbar" name="hide-loggedout-adminbar" type="checkbox" value="1" <?php checked( !bp_hide_loggedout_adminbar( false ) ); ?> /> 31 <label for="hide-loggedout-adminbar"><?php _e( 'Show the admin bar for logged out users', 'buddypress' ); ?></label> 32 33 <?php 34 } 35 36 /** 37 * Allow subscriptions setting field 38 * 39 * @since BuddyPress (r2737) 40 * 41 * @uses checked() To display the checked attribute 42 */ 43 function bp_admin_setting_callback_account_deletion() { 44 ?> 45 46 <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( true ) ); ?> /> 47 <label for="bp-disable-account-deletion"><?php _e( 'Allow registered members to delete their own accounts', 'buddypress' ); ?></label> 48 49 <?php 50 } 51 52 /** 53 * Use the WordPress editor setting field 54 * 55 * @since BuddyPress (r3586) 56 * 57 * @uses checked() To display the checked attribute 58 */ 59 function bp_admin_setting_callback_use_wp_editor() { 60 ?> 61 62 <input id="_bp_use_wp_editor" name="_bp_use_wp_editor" type="checkbox" id="_bp_use_wp_editor" value="1" <?php checked( bp_use_wp_editor( true ) ); ?> /> 63 <label for="_bp_use_wp_editor"><?php _e( 'Use the fancy WordPress editor to create and edit topics and replies', 'buddypress' ); ?></label> 64 65 <?php 66 } 67 68 /** Activity *******************************************************************/ 69 70 /** 71 * Groups settings section description for the settings page 72 * 73 * @since BuddyPress (1.6) 74 */ 75 function bp_admin_setting_callback_activity_section() { } 76 77 /** 78 * Allow Akismet setting field 79 * 80 * @since BuddyPress (r3575) 81 * 82 * @uses checked() To display the checked attribute 83 */ 84 function bp_admin_setting_callback_activity_akismet() { 85 ?> 86 87 <input id="_bp_enable_akismet" name="_bp_enable_akismet" type="checkbox" value="1" <?php checked( bp_is_akismet_active( true ) ); ?> /> 88 <label for="_bp_enable_akismet"><?php _e( 'Allow Akismet to scan for activity stream spam', 'buddypress' ); ?></label> 89 90 <?php 91 } 92 93 /** XProfile ******************************************************************/ 94 95 /** 96 * Profile settings section description for the settings page 97 * 98 * @since BuddyPress (1.0) 99 */ 100 function bp_admin_setting_callback_xprofile_section() { } 25 101 26 102 /** … … 41 117 42 118 /** 43 * Throttle setting field44 *45 * @since BuddyPress (r2737)46 *47 * @uses bp_form_option() To output the option value48 */49 function bp_admin_setting_callback_admin_bar() {50 ?>51 52 <input id="hide-loggedout-adminbar" name="hide-loggedout-adminbar" type="checkbox" value="1" <?php checked( !bp_hide_loggedout_adminbar( false ) ); ?> />53 <label for="hide-loggedout-adminbar"><?php _e( 'Show the admin bar for guest/anonymous users', 'buddypress' ); ?></label>54 55 <?php56 }57 58 /**59 119 * Allow favorites setting field 60 120 * … … 67 127 68 128 <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( true ) ); ?> /> 69 <label for="bp-disable-avatar-uploads"><?php _e( 'Allow members to upload avatars', 'buddypress' ); ?></label> 70 71 <?php 72 } 73 74 /** 75 * Allow subscriptions setting field 76 * 77 * @since BuddyPress (r2737) 78 * 79 * @uses checked() To display the checked attribute 80 */ 81 function bp_admin_setting_callback_account_deletion() { 82 ?> 83 84 <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( true ) ); ?> /> 85 <label for="bp-disable-account-deletion"><?php _e( 'Allow members to delete their own accounts', 'buddypress' ); ?></label> 86 87 <?php 88 } 89 90 /** 91 * Use the WordPress editor setting field 92 * 93 * @since BuddyPress (r3586) 94 * 95 * @uses checked() To display the checked attribute 96 */ 97 function bp_admin_setting_callback_use_wp_editor() { 98 ?> 99 100 <input id="_bp_use_wp_editor" name="_bp_use_wp_editor" type="checkbox" id="_bp_use_wp_editor" value="1" <?php checked( bp_use_wp_editor( true ) ); ?> /> 101 <label for="_bp_use_wp_editor"><?php _e( 'Use the fancy WordPress editor to create and edit topics and replies', 'buddypress' ); ?></label> 102 103 <?php 104 } 105 106 /** Activity *******************************************************************/ 129 <label for="bp-disable-avatar-uploads"><?php _e( 'Allow registered members to upload avatars', 'buddypress' ); ?></label> 130 131 <?php 132 } 133 134 /** Groups Section ************************************************************/ 107 135 108 136 /** … … 111 139 * @since BuddyPress (1.6) 112 140 */ 113 function bp_admin_setting_callback_activity_section() { 114 ?> 115 116 <p><?php _e( 'Settings for the Actvity component', 'buddypress' ); ?></p> 117 118 <?php 119 } 120 121 /** 122 * Allow Akismet setting field 123 * 124 * @since BuddyPress (r3575) 125 * 126 * @uses checked() To display the checked attribute 127 */ 128 function bp_admin_setting_callback_activity_akismet() { 129 ?> 130 131 <input id="_bp_enable_akismet" name="_bp_enable_akismet" type="checkbox" value="1" <?php checked( bp_is_akismet_active( true ) ); ?> /> 132 <label for="_bp_enable_akismet"><?php _e( 'Allow Akismet to scan for activity stream spam', 'buddypress' ); ?></label> 133 134 <?php 135 } 136 137 /** Groups Section ************************************************************/ 138 139 /** 140 * Groups settings section description for the settings page 141 * 142 * @since BuddyPress (1.6) 143 */ 144 function bp_admin_setting_callback_groups_section() { 145 ?> 146 147 <p><?php _e( 'Settings for the Groups component', 'buddypress' ); ?></p> 148 149 <?php 150 } 141 function bp_admin_setting_callback_groups_section() { } 151 142 152 143 /** … … 167 158 } 168 159 160 /** Forums Section ************************************************************/ 161 162 /** 163 * Forums settings section description for the settings page 164 * 165 * @since BuddyPress (1.6) 166 */ 167 function bp_admin_setting_callback_bbpress_section() { } 168 169 /** 170 * Allow topic and reply revisions 171 * 172 * @since BuddyPress (1.6) 173 * @uses checked() To display the checked attribute 174 * @uses bp_get_option() To get the config location 175 * @uses bp_form_option() To get the sanitized form option 176 */ 177 function bp_admin_setting_callback_bbpress_configuration() { 178 179 $config_location = bp_get_option( 'bb-config-location' ); 180 $file_exists = (bool) ( file_exists( $config_location ) || is_file( $config_location ) ); ?> 181 182 <input name="bb-config-location" type="text" id="bb-config-location" value="<?php bp_form_option( 'bb-config-location', '' ); ?>" class="medium-text" style="width: 300px;" /> 183 184 <?php if ( false === $file_exists ) : ?> 185 186 <a class="button" href="<?php bp_admin_url( 'admin.php?page=bb-forums-setup&repair=1' ); ?>" title="<?php _e( 'Attempt to save a new config file.', 'buddypress' ); ?>"><?php _e( 'Repair', 'buddypress' ) ?></a> 187 <span class="attention"><?php _e( 'File does not exist', 'buddypress' ); ?></span> 188 189 <?php endif; ?> 190 191 <p class="description"><?php _e( 'Absolute path to your bbPress configuration file.', 'buddypress' ); ?></p> 192 193 <?php 194 } 195 169 196 /** Settings Page *************************************************************/ 170 197 … … 180 207 function bp_core_admin_settings() { 181 208 global $wp_settings_fields; 182 183 // We're saving our own options, until the WP Settings API is updated to work with Multisite184 $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) );185 209 186 210 if ( !empty( $_POST['submit'] ) ) { 187 211 check_admin_referer( 'buddypress-options' ); 188 212 189 213 // Because many settings are saved with checkboxes, and thus will have no values 190 214 // in the $_POST array when unchecked, we loop through the registered settings … … 193 217 foreach( $settings as $setting_name => $setting ) { 194 218 $value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : ''; 195 219 196 220 bp_update_option( $setting_name, $value ); 197 221 } 198 222 } 199 223 } 200 224 201 225 // Some legacy options are not registered with the Settings API 202 226 $legacy_options = array( … … 207 231 'bp_restrict_group_creation' 208 232 ); 209 233 210 234 foreach( $legacy_options as $legacy_option ) { 211 235 // Note: Each of these options is represented by its opposite in the UI … … 216 240 } 217 241 } 218 ?> 242 243 // We're saving our own options, until the WP Settings API is updated to work with Multisite 244 $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ); ?> 219 245 220 246 <div class="wrap"> … … 368 394 /** bbPress Core ******************************************************/ 369 395 370 if ( defined( 'BBP_VERSION') ) {396 if ( bp_forums_is_bbpress_active() ) { 371 397 372 398 // Forum archive slug -
trunk/bp-core/bp-core-admin.php
r5868 r5885 307 307 add_settings_section( 'bp_main', __( 'Main Settings', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' ); 308 308 309 // Edit lock setting310 add_settings_field( '_bp_profile_sync', __( 'Profile Syncing', 'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_main' );311 register_setting ( 'buddypress', '_bp_profile_sync', 'intval' );312 313 309 // Throttle setting 314 310 add_settings_field( '_bp_admin_bar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' ); 315 311 register_setting ( 'buddypress', '_bp_admin_bar', 'intval' ); 316 312 317 // Allow topic and reply revisions318 add_settings_field( '_bp_avatar_uploads', __( 'Avatar Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_main' );319 register_setting ( 'buddypress', '_bp_avatar_uploads', 'intval' );320 321 313 // Allow favorites setting 322 314 add_settings_field( '_bp_account_deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' ); 323 315 register_setting ( 'buddypress', '_bp_account_deletion', 'intval' ); 324 316 325 // Allow global access setting 326 if ( function_exists( 'wp_editor' ) ) { 327 add_settings_field( '_bp_use_wp_editor', __( 'Fancy Editor', 'buddypress' ), 'bp_admin_setting_callback_use_wp_editor', 'buddypress', 'bp_main' ); 328 register_setting ( 'buddypress', '_bp_use_wp_editor', 'intval' ); 317 /** XProfile Section **************************************************/ 318 319 if ( bp_is_active( 'xprofile' ) ) { 320 321 // Add the main section 322 add_settings_section( 'bp_xprofile', __( 'Profile Settings', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' ); 323 324 // Allow topic and reply revisions 325 add_settings_field( '_bp_avatar_uploads', __( 'Avatar Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile' ); 326 register_setting ( 'buddypress', '_bp_avatar_uploads', 'intval' ); 327 328 // Profile sync setting 329 add_settings_field( '_bp_profile_sync', __( 'Profile Syncing', 'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' ); 330 register_setting ( 'buddypress', '_bp_profile_sync', 'intval' ); 329 331 } 330 332 331 333 /** Groups Section ****************************************************/ 332 334 333 // @todo move into groups component334 335 if ( bp_is_active( 'groups' ) ) { 335 336 … … 339 340 // Allow subscriptions setting 340 341 add_settings_field( '_bp_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups' ); 341 register_setting ( 'buddypress', '_bp_group_creation', 'intval' ); 342 register_setting ( 'buddypress', '_bp_group_creation', 'intval' ); 343 } 344 345 /** Forums ************************************************************/ 346 347 if ( bp_is_active( 'forums' ) && bp_forums_is_installed_correctly() ) { 348 349 // Add the main section 350 add_settings_section( 'bp_forums', __( 'Forums Settings', 'buddypress' ), 'bp_admin_setting_callback_bbpress_section', 'buddypress' ); 351 352 // Allow subscriptions setting 353 add_settings_field( 'bb-config-location', __( 'bbPress Configuration', 'buddypress' ), 'bp_admin_setting_callback_bbpress_configuration', 'buddypress', 'bp_forums' ); 354 register_setting ( 'buddypress', 'bb-config-location', '' ); 342 355 } 343 356 344 357 /** Activity Section **************************************************/ 345 358 346 // @todo move into activity component347 359 if ( bp_is_active( 'activity' ) && ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) ) { 348 360 -
trunk/bp-forums/bp-forums-admin.php
r5749 r5885 1 1 <?php 2 2 3 // Exit if accessed directly 3 4 if ( !defined( 'ABSPATH' ) ) exit; 4 5 6 /** UI ************************************************************************/ 7 5 8 function bp_forums_add_admin_menu() { 6 9 7 10 if ( ! bp_current_user_can( 'bp_moderate' ) ) 11 return; 12 13 if ( ! bp_forums_is_repair() ) 8 14 return; 9 15 … … 18 24 19 25 function bp_forums_bbpress_admin() { 20 21 $action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?> 26 ?> 22 27 23 28 <div class="wrap"> 29 24 30 <?php screen_icon( 'buddypress' ); ?> 25 31 26 32 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Forums', 'buddypress' ) ); ?></h2> 27 33 28 <?php if ( isset( $_POST['submit'] ) ) : ?> 29 30 <div id="message" class="updated fade"> 31 <p><?php _e( 'Settings Saved.', 'buddypress' ) ?></p> 34 <h3><?php _e( 'Forum Repair', 'buddypress' ); ?></h3> 35 36 <?php if ( bp_forums_is_repair() ) : ?> 37 38 <p><?php printf( __( 'The following configuration was successfully saved to: %s', 'buddypress' ), bp_get_option( 'bb-config-location' ) );?></p> 39 40 <div id="template"> 41 <textarea cols="70" rows="25" name="bb-config" id="bb-config"><?php echo bp_forums_bbpress_install( bp_get_option( 'bb-config-location' ) ); ?></textarea> 32 42 </div> 33 43 34 <?php endif; ?> 35 36 <?php 37 38 if ( isset( $_REQUEST['reinstall'] ) || !bp_forums_is_installed_correctly() ) : 39 40 // Delete the bb-config.php location option 41 bp_delete_option( 'bb-config-location' ); 42 bp_forums_bbpress_install_wizard(); 43 44 else : ?> 45 46 <div style="width: 45%; float: left; margin-top: 20px;"> 47 <h3><?php _e( '(Installed)', 'buddypress' ); ?> <?php _e( 'Forums for Groups', 'buddypress' ) ?></h3> 48 49 <p><?php _e( 'Give each individual group its own discussion forum. Choose this if you\'d like to keep your members\' conversations separated into distinct areas.' , 'buddypress' ); ?></p> 50 <p class="description"><?php _e( 'You may use an existing bbPress installation if you have one.', 'buddypress' ); ?></p> 51 52 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4> 53 <ul class="description" style="list-style: square; margin-left: 30px;"> 54 <li><?php _e( 'Group Integration', 'buddypress' ); ?></p></li> 55 <li><?php _e( 'Member Profile Integration', 'buddypress' ); ?></p></li> 56 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li> 57 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li> 58 </ul> 59 60 <div> 61 <a class="button button-primary" href="<?php echo $action ?>"><?php _e( 'Uninstall Group Forums', 'buddypress' ) ?></a> 62 </div> 63 </div> 64 65 <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;"> 66 <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3> 67 <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p> 68 <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p> 69 70 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4> 71 <ul class="description" style="list-style: square; margin-left: 30px;"> 72 <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li> 73 <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li> 74 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li> 75 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li> 76 </ul> 77 <div> 78 <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> 79 </div> 80 </div> 81 82 <?php endif; ?> 83 84 </div> 85 <?php 86 } 87 88 function bp_forums_bbpress_install_wizard() { 89 $post_url = network_admin_url( 'admin.php?page=bb-forums-setup' ); 90 91 $step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : ''; 92 93 switch( $step ) { 94 case 'existing': 95 if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) { 96 if ( !bp_forums_configure_existing_install() ) { 97 _e( 'The bb-config.php file was not found at that location, please try again.', 'buddypress' ); 98 } else { 99 ?> 100 <h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3> 101 <p><?php _e( 'BuddyPress will now use its internal copy of bbPress to run the forums on your site. If you wish, you can remove your old bbPress installation files, as long as you keep the bb-config.php file in the same location.', 'buddypress' ) ?></p><?php 102 } 103 } else { ?> 104 105 <form action="" method="post"> 106 <h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3> 107 <p><?php _e( "BuddyPress can make use of your existing bbPress install. Just provide the location of your <code>bb-config.php</code> file, and BuddyPress will do the rest.", 'buddypress' ) ?></p> 108 <p><label><code>bb-config.php</code> file location:</label><br /><input style="width: 50%" type="text" name="bbconfigloc" id="bbconfigloc" value="<?php echo str_replace( 'buddypress', '', $_SERVER['DOCUMENT_ROOT'] ) ?>" /></p> 109 <p><input type="submit" class="button-primary" value="<?php _e( 'Complete Installation', 'buddypress' ) ?>" /></p> 110 <input type="hidden" name="step" value="existing" /> 111 <input type="hidden" name="doinstall" value="1" /> 112 <?php wp_nonce_field( 'bp_forums_existing_install_init' ) ?> 113 </form> 114 115 <?php 116 } 117 break; 118 119 case 'new': 120 if ( isset( $_REQUEST['doinstall'] ) && 1 == (int) $_REQUEST['doinstall'] ) { 121 $result = bp_forums_bbpress_install(); 122 123 switch ( $result ) { 124 case 1: 125 _e( '<p>All done! Configuration settings have been saved to the file <code>bb-config.php</code> in the root of your WordPress install.</p>', 'buddypress' ); 126 break; 127 default: 128 // Just write the contents to screen 129 _e( '<p>A configuration file could not be created. No problem, but you will need to save the text shown below into a file named <code>bb-config.php</code> in the root directory of your WordPress installation before you can start using the forum functionality.</p>', 'buddypress' ); ?> 130 131 <textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo htmlspecialchars( $result ); ?></textarea> 132 133 <?php 134 break; 135 } 136 } else { ?> 137 138 <h3><?php _e( 'New bbPress Installation', 'buddypress' ) ?></h3> 139 <p><?php _e( "You've decided to set up a new installation of bbPress for forum management in BuddyPress. This is very simple and is usually just a one click 140 process. When you're ready, hit the link below.", 'buddypress' ) ?></p> 141 <p><a class="button-primary" href="<?php echo wp_nonce_url( $post_url . '&step=new&doinstall=1', 'bp_forums_new_install_init' ) ?>"><?php _e( 'Complete Installation', 'buddypress' ) ?></a></p> 142 143 <?php 144 } 145 break; 146 147 default: 148 if ( !file_exists( BP_PLUGIN_DIR . '/bp-forums/bbpress/' ) ) { ?> 149 150 <div id="message" class="error"> 151 <p><?php printf( __( 'bbPress files were not found. To install the forums component you must download a copy of bbPress and make sure it is in the folder: "%s"', 'buddypress' ), 'wp-content/plugins/buddypress/bp-forums/bbpress/' ) ?></p> 152 </div> 153 154 <?php } else { 155 156 // Include the plugin install 157 44 <?php elseif ( bp_forums_is_migrate() ) : ?> 45 46 <?php 158 47 add_thickbox(); 159 48 wp_enqueue_script( 'plugin-install' ); … … 161 50 ?> 162 51 163 <div style="width: 45%; float: left; margin-top: 20px;"> 164 <h3><?php _e( 'Forums for Groups', 'buddypress' ) ?></h3> 165 166 <p><?php _e( 'Give each individual group its own discussion forum. Choose this if you\'d like to keep your members\' conversations separated into distinct areas.' , 'buddypress' ); ?></p> 167 <p class="description"><?php _e( 'You may use an existing bbPress installation if you have one.', 'buddypress' ); ?></p> 168 169 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4> 170 <ul class="description" style="list-style: square; margin-left: 30px;"> 171 <li><?php _e( 'Group Integration', 'buddypress' ); ?></p></li> 172 <li><?php _e( 'Member Profile Integration', 'buddypress' ); ?></p></li> 173 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li> 174 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li> 175 </ul> 176 177 <div> 178 <a class="button button-primary" href="<?php echo $post_url . '&step=new' ?>"><?php _e( 'Install Group Forums', 'buddypress' ) ?></a> 179 <a class="button" href="<?php echo $post_url . '&step=existing' ?>"><?php _e( 'Use Existing Installation', 'buddypress' ) ?></a> 180 </div> 181 </div> 182 183 <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;"> 184 <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3> 185 <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p> 186 <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p> 187 188 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4> 189 <ul class="description" style="list-style: square; margin-left: 30px;"> 190 <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li> 191 <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li> 192 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li> 193 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li> 194 </ul> 195 <div> 196 <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> 197 </div> 198 </div> 199 200 <?php } 201 break; 202 } 203 } 204 205 function bp_forums_configure_existing_install() { 206 207 check_admin_referer( 'bp_forums_existing_install_init' ); 208 209 // Sanitize $_REQUEST['bbconfigloc'] 210 $_REQUEST['bbconfigloc'] = apply_filters( 'bp_forums_bbconfig_location', $_REQUEST['bbconfigloc'] ); 211 212 if ( false === strpos( $_REQUEST['bbconfigloc'], 'bb-config.php' ) ) { 213 if ( '/' != substr( $_REQUEST['bbconfigloc'], -1, 1 ) ) 214 $_REQUEST['bbconfigloc'] .= '/'; 215 216 $_REQUEST['bbconfigloc'] .= 'bb-config.php'; 217 } 218 219 bp_update_option( 'bb-config-location', $_REQUEST['bbconfigloc'] ); 220 221 if ( !file_exists( $_REQUEST['bbconfigloc'] ) ) 222 return false; 223 224 return true; 225 } 226 227 function bp_forums_bbpress_install() { 52 <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> 53 54 <?php else : ?> 55 56 <?php endif; ?> 57 58 </div> 59 <?php 60 } 61 62 /** _is_ **********************************************************************/ 63 64 /** 65 * Trying to repair a bbPress 1.x installation 66 * 67 * @since BuddyPress (1.6) 68 * @return boolean True if option exists, false if not 69 */ 70 function bp_forums_is_repair() { 71 72 // Bail if bbPress 1.x was never installed 73 if ( isset( $_REQUEST['repair'] ) && bp_forums_is_installed_correctly() ) 74 return true; 75 76 return false; 77 } 78 79 /** 80 * bbPress 1.x is installed, and we're moving to bbPress 2.x 81 * 82 * @since BuddyPress (1.6) 83 * @return boolean True if option exists, false if not 84 */ 85 function bp_forums_is_migrate() { 86 87 // Bail if bbPress 1.x was never installed 88 if ( isset( $_REQUEST['migrate'] ) && bp_forums_is_installed_correctly() ) 89 return true; 90 91 return false; 92 } 93 94 /** 95 * bbPress was never installed before, and bbPress 2.x is not installed yet 96 * 97 * @since BuddyPress (1.6) 98 * @return boolean True if option exists, false if not 99 */ 100 function bp_forums_is_fresh_install() { 101 102 // Bail if bbPress 1.x was never installed 103 if ( isset( $_REQUEST['install'] ) && ! bp_forums_is_installed_correctly() ) 104 return true; 105 106 return false; 107 } 108 109 /** 110 * Both bbPress 1.x and bbPress 2.x are installed 111 * 112 * @since BuddyPress (1.6) 113 * @return boolean True if option exists, false if not 114 */ 115 function bp_forums_is_hybrid_install() { 116 117 // Bail if bbPress 1.x was never installed 118 if ( isset( $_REQUEST['install'] ) && bp_forums_is_bbpress_active && bp_forums_is_installed_correctly() ) 119 return true; 120 121 return false; 122 } 123 124 /** Config ********************************************************************/ 125 126 function bp_forums_bbpress_install( $location = '' ) { 228 127 global $wpdb, $bp; 229 128 230 check_admin_referer( 'bp_forums_new_install_init' ); 129 if ( empty( $location ) ) 130 $location = ABSPATH . 'bb-config.php'; 231 131 232 132 // Create the bb-config.php file 233 133 $initial_write = bp_forums_bbpress_write( 234 134 BP_PLUGIN_DIR . '/bp-forums/bbpress/bb-config-sample.php', 235 ABSPATH . 'bb-config.php',135 $location, 236 136 array( 237 137 "define( 'BBDB_NAME'," => array( "'bbpress'", "'" . DB_NAME . "'" ), … … 251 151 252 152 // Add the custom user and usermeta entries to the config file 253 if ( $initial_write == 1 ) 254 $file = file_get_contents( ABSPATH . 'bb-config.php');255 else153 if ( $initial_write == 1 ) { 154 $file = file_get_contents( $location ); 155 } else { 256 156 $file = &$initial_write; 157 } 257 158 258 159 $file = trim( $file ); 259 if ( '?>' == substr( $file, -2, 2 ) ) 160 if ( '?>' == substr( $file, -2, 2 ) ) { 260 161 $file = substr( $file, 0, -2 ); 162 } 261 163 262 164 $file .= "\n" . '$bb->custom_user_table = \'' . $wpdb->users . '\';'; … … 265 167 $file .= "\n" . '$bb->name = \'' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';'; 266 168 267 if ( is_multisite() ) 169 if ( is_multisite() ) { 268 170 $file .= "\n" . '$bb->wordpress_mu_primary_blog_id = ' . bp_get_root_blog_id() . ';'; 269 270 if ( defined( 'AUTH_SALT' ) ) 171 } 172 173 if ( defined( 'AUTH_SALT' ) ) { 271 174 $file .= "\n\n" . 'define(\'BB_AUTH_SALT\', \'' . addslashes( AUTH_SALT ) . '\');'; 272 273 if ( defined( 'LOGGED_IN_SALT' ) ) 175 } 176 177 if ( defined( 'LOGGED_IN_SALT' ) ) { 274 178 $file .= "\n" . 'define(\'BB_LOGGED_IN_SALT\', \'' . addslashes( LOGGED_IN_SALT ) . '\');'; 275 276 if ( defined( 'SECURE_AUTH_SALT' ) ) 179 } 180 181 if ( defined( 'SECURE_AUTH_SALT' ) ) { 277 182 $file .= "\n" . 'define(\'BB_SECURE_AUTH_SALT\', \'' . addslashes( SECURE_AUTH_SALT ) . '\');'; 183 } 278 184 279 185 $file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);'; … … 281 187 282 188 if ( $initial_write == 1 ) { 283 $file_handle = fopen( ABSPATH . 'bb-config.php', 'w' );189 $file_handle = fopen( $location, 'w' ); 284 190 fwrite( $file_handle, $file ); 285 191 fclose( $file_handle ); … … 288 194 } 289 195 290 bp_update_option( 'bb-config-location', ABSPATH . 'bb-config.php' ); 291 return $initial_write; 196 bp_update_option( 'bb-config-location', $location ); 197 198 return $file; 292 199 } 293 200 294 201 function bp_forums_bbpress_write( $file_source, $file_target, $alterations ) { 295 202 296 if ( !$file_source || !file_exists( $file_source ) || !is_file( $file_source ) )203 if ( empty( $file_source ) || !file_exists( $file_source ) || !is_file( $file_source ) ) { 297 204 return -1; 298 299 if ( !$file_target ) 205 } 206 207 if ( empty( $file_target ) ) { 300 208 $file_target = $file_source; 301 302 if ( !$alterations || !is_array( $alterations ) ) 209 } 210 211 if ( empty( $alterations ) || !is_array( $alterations ) ) { 303 212 return -2; 213 } 304 214 305 215 // Get the existing lines in the file … … 336 246 } 337 247 338 if ( empty( $writable ) ) 248 if ( empty( $writable ) ) { 339 249 return trim( join( null, $modified_lines ) ); 250 } 340 251 341 252 // Open the file for writing - rewrites the whole file -
trunk/bp-forums/bp-forums-bbpress-sa.php
r5796 r5885 40 40 41 41 $bb = new stdClass(); 42 require( $bp->forums->bbconfig);42 require( bp_get_option( 'bb-config-location' ) ); 43 43 44 44 // Setup the global database connection -
trunk/bp-forums/bp-forums-functions.php
r5871 r5885 1 1 <?php 2 2 3 // Exit if accessed directly 3 4 if ( !defined( 'ABSPATH' ) ) exit; 4 5 6 /** bbPress 2.x ***************************************************************/ 7 8 /** 9 * Used to see if bbPress 2.x is installed and active 10 * 11 * @since BuddyPress (1.6) 12 * @return boolean True if bbPress 2.x is active, false if not 13 */ 14 function bp_forums_is_bbpress_active() { 15 16 // Single site 17 if ( is_plugin_active( 'bbpress/bbpress.php' ) ) 18 return true; 19 20 // Network active 21 if ( is_plugin_active_for_network( 'bbpress/bbpress.php' ) ) 22 return true; 23 24 // Nope 25 return false; 26 } 27 28 /** bbPress 1.x ***************************************************************/ 29 30 /** 31 * If the bb-config-location option exists, bbPress 1.x was previously installed 32 * 33 * @since BuddyPress (1.2) 34 * @return boolean True if option exists, false if not 35 */ 5 36 function bp_forums_is_installed_correctly() { 6 global $bp; 7 8 if ( isset( $bp->forums->bbconfig ) && is_file( $bp->forums->bbconfig ) ) 37 if ( bp_get_option( 'bb-config-location' ) ) 9 38 return true; 10 39 -
trunk/bp-forums/bp-forums-loader.php
r5868 r5885 47 47 if ( !defined( 'BP_FORUMS_SLUG' ) ) 48 48 define( 'BP_FORUMS_SLUG', $this->id ); 49 50 // The location of the bbPress stand-alone config file51 if ( isset( $bp->site_options['bb-config-location'] ) )52 $this->bbconfig = $bp->site_options['bb-config-location'];53 49 54 50 // All globals for messaging component.
Note: See TracChangeset
for help on using the changeset viewer.