bp_forums_bbpress_install_wizard

The BuddyPress bp forums bbpress install wizard function.

Description

bp_forums_bbpress_install_wizard(); 

Usage

  1. if ( !function_exists( 'bp_forums_bbpress_install_wizard' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/deprecated/1.6.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_forums_bbpress_install_wizard(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/deprecated/1.6.php  
  1. function bp_forums_bbpress_install_wizard() { 
  2. $post_url = bp_get_admin_url( 'admin.php?page=bb-forums-setup' ); 
  3. $bbpress_plugin_is_active = false; 
  4.  
  5. $step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : ''; 
  6.  
  7. // The text and URL of the Site Wide Forums button differs depending on whether bbPress 
  8. // is running. 
  9. if ( is_plugin_active( 'bbpress/bbpress.php' ) ) { 
  10. $bbpress_plugin_is_active = true; 
  11.  
  12. // The bbPress admin page will always be on the root blog. switch_to_blog() will 
  13. // pass through if we're already there. 
  14. $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ); 
  15.  
  16. $button_text = __( 'Configure bbPress', buddypress ); 
  17. } else { 
  18. $button_url = bp_get_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); 
  19. $button_text = __( 'Install bbPress', buddypress ); 
  20.  
  21. switch( $step ) { 
  22. case 'existing': 
  23. if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) { 
  24. if ( !bp_forums_configure_existing_install() ) { 
  25. /** translators: %s: bb-config.php */ 
  26. printf( __( 'The %s file was not found at that location. Please try again.', buddypress ), '<code>bb-config.php</code>' ); 
  27. } else { 
  28. ?> 
  29. <h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', buddypress ) ?></h3> 
  30. <?php /** translators: %s: bb-config.php */ ?> 
  31. <p><?php printf( __( '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 %s file in the same location.', buddypress ), '<code>bb-config.php</code>' ); ?></p><?php 
  32. } else { ?> 
  33.  
  34. <form action="" method="post"> 
  35. <h3><?php _e( 'Existing bbPress Installation', buddypress ) ?></h3> 
  36. <?php /** translators: %s: bb-config.php */ ?> 
  37. <p><?php printf( __( 'BuddyPress can make use of your existing bbPress install. Just provide the location of your %s file, and BuddyPress will do the rest.', buddypress ), '<code>bb-config.php</code>' ); ?></p> 
  38. <?php /** translators: %s: bb-config.php */ ?> 
  39. <p><label><?php printf( __( '%s file location:', buddypress ), '<code>bb-config.php</code>' ); ?></label><br /><input style="width: 50%" type="text" name="bbconfigloc" id="bbconfigloc" value="<?php echo esc_attr( str_replace( buddypress, '', $_SERVER['DOCUMENT_ROOT'] ) ) ?>" /></p> 
  40. <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Complete Installation', buddypress ) ?>" /></p> 
  41. <input type="hidden" name="step" value="existing" /> 
  42. <input type="hidden" name="doinstall" value="1" /> 
  43. <?php wp_nonce_field( 'bp_forums_existing_install_init' ) ?> 
  44. </form> 
  45.  
  46. <?php 
  47. break; 
  48.  
  49. case 'new': 
  50. if ( isset( $_REQUEST['doinstall'] ) && 1 == (int)$_REQUEST['doinstall'] ) { 
  51.  
  52. switch ( $result ) { 
  53. case 1: 
  54. echo '<p>'; 
  55. /** translators: %s: bb-config.php */ 
  56. printf( __( 'All done! Configuration settings have been saved to the %s file in the root of your WordPress install.', buddypress ), '<code>bb-config.php</code>' ); 
  57. echo '</p>'; 
  58. break; 
  59. default: 
  60. // Just write the contents to screen. 
  61. echo '<p>'; 
  62. /** translators: %s: bb-config.php */ 
  63. printf( __( 'A configuration file could not be created. No problem, but you will need to save the text shown below into a file named %s in the root directory of your WordPress installation before you can start using the forum functionality.', buddypress ), '<code>bb-config.php</code>' ); 
  64. echo '</p>'; 
  65. ?> 
  66. <textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo esc_textarea( $result ); ?></textarea> 
  67. <?php 
  68. break; 
  69. } else { ?> 
  70.  
  71. <h3><?php _e( 'New bbPress Installation', buddypress ) ?></h3> 
  72. <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 
  73. process. When you're ready, hit the link below.", buddypress ) ?></p> 
  74. <p><a class="button-primary" href="<?php echo esc_url( wp_nonce_url( $post_url . '&step=new&doinstall=1', 'bp_forums_new_install_init' ) ); ?>"><?php _e( 'Complete Installation', buddypress ) ?></a></p> 
  75.  
  76. <?php 
  77. break; 
  78.  
  79. default: 
  80. if ( !file_exists(buddypress)->plugin_dir . '/bp-forums/bbpress/' ) ) { ?> 
  81.  
  82. <div id="message" class="error"> 
  83. <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> 
  84. </div> 
  85.  
  86. <?php } else { 
  87.  
  88. // Include the plugin install. 
  89. add_thickbox(); 
  90. wp_enqueue_script( 'plugin-install' ); 
  91. wp_admin_css( 'plugin-install' ); 
  92. ?> 
  93.  
  94. <div style="width: 45%; float: left; margin-top: 20px;"> 
  95. <h3><?php _e( 'Forums for Groups', buddypress ) ?></h3> 
  96.  
  97. <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> 
  98.  
  99. <p><?php _e( 'Note: This component is retired and will not be receiving any updates in the future. Only use this component if your current site relies on it.' , buddypress ); ?></p> 
  100.  
  101. <h4 style="margin-bottom: 10px;"><?php _e( 'Features', buddypress ); ?></h4> 
  102. <ul class="description" style="list-style: square; margin-left: 30px;"> 
  103. <li><?php _e( 'Group Integration', buddypress ); ?></p></li> 
  104. <li><?php _e( 'Member Profile Integration', buddypress ); ?></p></li> 
  105. <li><?php _e( 'Activity Stream Integration', buddypress ); ?></p></li> 
  106. <li><?php _e( '@ Mention Integration', buddypress ); ?></p></li> 
  107. </ul> 
  108.  
  109. <div> 
  110. <a class="button button-primary" href="<?php echo esc_url( $post_url ) . '&step=new' ?>"><?php _e( 'Install Group Forums', buddypress ) ?></a>   
  111. <a class="button" href="<?php echo esc_url( $post_url ) . '&step=existing' ?>"><?php _e( 'Use Existing Installation', buddypress ) ?></a> 
  112. </div> 
  113. </div> 
  114.  
  115. <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;"> 
  116. <h3><?php _e( 'New! bbPress', buddypress ) ?></h3> 
  117. <p><?php _e( 'bbPress is a brand-new forum plugin from one of the lead developers of BuddyPress.', buddypress ) ?></p> 
  118.  
  119. <p><?php _e( 'It boasts a bunch of cool features that the BP Legacy Discussion Forums does not have including:', buddypress ) ?></p> 
  120.  
  121. <ul class="description" style="list-style: square; margin-left: 30px;"> 
  122. <li><?php _e( 'Non-group specific forum creation', buddypress ); ?></p></li> 
  123. <li><?php _e( 'Moderation via the WP admin dashboard', buddypress ); ?></p></li> 
  124. <li><?php _e( 'Topic splitting', buddypress ); ?></p></li> 
  125. <li><?php _e( 'Revisions', buddypress ); ?></p></li> 
  126. <li><?php _e( 'Spam management', buddypress ); ?></p></li> 
  127. <li><?php _e( 'Subscriptions', buddypress ); ?></p></li> 
  128. <li><?php _e( 'And more!', buddypress ); ?></p></li> 
  129. </ul> 
  130.  
  131. <p><?php printf( __( 'If you decide to use bbPress, you will need to deactivate the legacy group forum component. For more info, <a href="%s">read this codex article</a>.', buddypress ), 'https://codex.buddypress.org/legacy/getting-started/using-bbpress-2-2-with-buddypress/' ) ?></p> 
  132. <div> 
  133. <a class="button button-primary <?php if ( ! $bbpress_plugin_is_active ) { echo esc_attr( 'thickbox' ); }?>" href="<?php echo esc_url( $button_url ) ?>"><?php echo esc_html( $button_text ) ?></a>   
  134. </div> 
  135. </div> 
  136.  
  137. <?php } 
  138. break;