[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/deprecated/ -> 1.6.php (source)

   1  <?php
   2  /**
   3   * BuddyPress Forums Deprecated Functions.
   4   *
   5   * This file contains all the deprecated functions for BuddyPress forums since
   6   * version 1.6. This was a major update for the forums component, moving from
   7   * bbPress 1.x to bbPress 2.x.
   8   *
   9   * @package BuddyPress
  10   * @subpackage Forums
  11   */
  12  
  13  // Exit if accessed directly.
  14  defined( 'ABSPATH' ) || exit;
  15  
  16  /**
  17   * Outputs the markup for the bb-forums-admin panel
  18   */
  19  function bp_forums_bbpress_admin() {
  20  
  21      // The text and URL of the Site Wide Forums button differs depending on whether bbPress
  22      // is running.
  23      if ( is_plugin_active( 'bbpress/bbpress.php' ) ) {
  24          // The bbPress admin page will always be on the root blog. switch_to_blog() will
  25          // pass through if we're already there.
  26          switch_to_blog( bp_get_root_blog_id() );
  27          $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) );
  28          restore_current_blog();
  29  
  30          $button_text = __( 'Configure bbPress', 'buddypress' );
  31      } else {
  32          $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' ) );
  33          $button_text = __( 'Install bbPress', 'buddypress' );
  34      }
  35  
  36      $action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
  37  
  38      <div class="wrap">
  39          <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Forums', 'buddypress' ) ); ?></h2>
  40  
  41          <?php if ( isset( $_POST['submit'] ) ) : ?>
  42  
  43              <div id="message" class="updated fade">
  44                  <p><?php _e( 'Settings Saved.', 'buddypress' ) ?></p>
  45              </div>
  46  
  47          <?php endif; ?>
  48  
  49          <?php
  50  
  51          if ( isset( $_REQUEST['reinstall'] ) || !bp_forums_is_installed_correctly() ) :
  52  
  53              // Delete the bb-config.php location option.
  54              bp_delete_option( 'bb-config-location' );
  55  
  56              // Now delete the bb-config.php file.
  57              @unlink( ABSPATH . 'bb-config.php' );
  58  
  59              // Show the updated wizard.
  60              bp_forums_bbpress_install_wizard();
  61  
  62          else : ?>
  63  
  64              <div style="width: 45%; float: left; margin-top: 20px;">
  65                  <h3><?php _e( '(Installed)', 'buddypress' ); ?> <?php _e( 'Forums for Groups', 'buddypress' ) ?></h3>
  66  
  67                  <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>
  68  
  69                  <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>
  70  
  71                  <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
  72                  <ul class="description" style="list-style: square; margin-left: 30px;">
  73                      <li><?php _e( 'Group Integration',           'buddypress' ); ?></p></li>
  74                      <li><?php _e( 'Member Profile Integration',  'buddypress' ); ?></p></li>
  75                      <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
  76                      <li><?php _e( '@ Mention Integration',       'buddypress' ); ?></p></li>
  77                  </ul>
  78  
  79                  <div>
  80                      <a class="button button-primary confirm" href="<?php echo $action ?>"><?php _e( 'Uninstall Group Forums', 'buddypress' ) ?></a> &nbsp;
  81                  </div>
  82              </div>
  83  
  84              <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">
  85                  <h3><?php _e( 'New! bbPress', 'buddypress' ) ?></h3>
  86                  <p><?php _e( 'bbPress is a brand-new forum plugin from one of the lead developers of BuddyPress.', 'buddypress' ) ?></p>
  87  
  88                  <p><?php _e( 'It boasts a bunch of cool features that the BP Legacy Discussion Forums does not have including:', 'buddypress' ) ?></p>
  89  
  90                  <ul class="description" style="list-style: square; margin-left: 30px;">
  91                      <li><?php _e( 'Non-group specific forum creation', 'buddypress' ); ?></p></li>
  92                      <li><?php _e( 'Moderation via the WP admin dashboard', 'buddypress' ); ?></p></li>
  93                      <li><?php _e( 'Topic splitting', 'buddypress' ); ?></p></li>
  94                      <li><?php _e( 'Revisions', 'buddypress' ); ?></p></li>
  95                      <li><?php _e( 'Spam management', 'buddypress' ); ?></p></li>
  96                      <li><?php _e( 'Subscriptions', 'buddypress' ); ?></p></li>
  97                      <li><?php _e( 'And more!', 'buddypress' ); ?></p></li>
  98                  </ul>
  99  
 100                  <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>
 101  
 102                  <div>
 103                      <a class="button thickbox button-primary" href="<?php echo esc_url( $button_url ) ?>"><?php echo esc_html( $button_text ) ?></a> &nbsp;
 104                  </div>
 105              </div>
 106  
 107          <?php endif; ?>
 108  
 109      </div>
 110  <?php
 111  }
 112  
 113  function bp_forums_bbpress_install_wizard() {
 114      $post_url                 = bp_get_admin_url( 'admin.php?page=bb-forums-setup' );
 115      $bbpress_plugin_is_active = false;
 116  
 117      $step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : '';
 118  
 119      // The text and URL of the Site Wide Forums button differs depending on whether bbPress
 120      // is running.
 121      if ( is_plugin_active( 'bbpress/bbpress.php' ) ) {
 122          $bbpress_plugin_is_active = true;
 123  
 124          // The bbPress admin page will always be on the root blog. switch_to_blog() will
 125          // pass through if we're already there.
 126          switch_to_blog( bp_get_root_blog_id() );
 127          $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) );
 128          restore_current_blog();
 129  
 130          $button_text = __( 'Configure bbPress', 'buddypress' );
 131      } else {
 132          $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' ) );
 133          $button_text = __( 'Install bbPress', 'buddypress' );
 134      }
 135  
 136      switch( $step ) {
 137          case 'existing':
 138              if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
 139                  if ( !bp_forums_configure_existing_install() ) {
 140                      /* translators: %s: bb-config.php */
 141                      printf( __( 'The %s file was not found at that location. Please try again.', 'buddypress' ), '<code>bb-config.php</code>' );
 142                  } else {
 143                      ?>
 144                      <h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
 145                      <?php /* translators: %s: bb-config.php */ ?>
 146                      <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
 147                  }
 148              } else { ?>
 149  
 150                      <form action="" method="post">
 151                          <h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3>
 152                          <?php /* translators: %s: bb-config.php */ ?>
 153                          <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>
 154                          <?php /* translators: %s: bb-config.php */ ?>
 155                          <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>
 156                          <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Complete Installation', 'buddypress' ) ?>" /></p>
 157                          <input type="hidden" name="step" value="existing" />
 158                          <input type="hidden" name="doinstall" value="1" />
 159                          <?php wp_nonce_field( 'bp_forums_existing_install_init' ) ?>
 160                      </form>
 161  
 162                  <?php
 163              }
 164          break;
 165  
 166          case 'new':
 167              if ( isset( $_REQUEST['doinstall'] ) && 1 == (int)$_REQUEST['doinstall'] ) {
 168                  $result = bp_forums_bbpress_install();
 169  
 170                  switch ( $result ) {
 171                      case 1:
 172                          echo '<p>';
 173                          /* translators: %s: bb-config.php */
 174                          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>' );
 175                          echo '</p>';
 176                          break;
 177                      default:
 178                          // Just write the contents to screen.
 179                          echo '<p>';
 180                          /* translators: %s: bb-config.php */
 181                          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>' );
 182                          echo '</p>';
 183                          ?>
 184                          <textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo esc_textarea( $result ); ?></textarea>
 185                          <?php
 186                          break;
 187                  }
 188              } else { ?>
 189  
 190                  <h3><?php _e( 'New bbPress Installation', 'buddypress' ) ?></h3>
 191                  <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
 192                  process. When you're ready, hit the link below.", 'buddypress' ) ?></p>
 193                  <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>
 194  
 195                  <?php
 196              }
 197          break;
 198  
 199          default:
 200              if ( !file_exists( buddypress()->plugin_dir . '/bp-forums/bbpress/' ) ) { ?>
 201  
 202                  <div id="message" class="error">
 203                      <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>
 204                  </div>
 205  
 206              <?php } else {
 207  
 208                  // Include the plugin install.
 209                  add_thickbox();
 210                  wp_enqueue_script( 'plugin-install' );
 211                  wp_admin_css( 'plugin-install' );
 212              ?>
 213  
 214                  <div style="width: 45%; float: left;  margin-top: 20px;">
 215                      <h3><?php _e( 'Forums for Groups', 'buddypress' ) ?></h3>
 216  
 217                      <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>
 218  
 219                      <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>
 220  
 221                      <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
 222                      <ul class="description" style="list-style: square; margin-left: 30px;">
 223                          <li><?php _e( 'Group Integration',           'buddypress' ); ?></p></li>
 224                          <li><?php _e( 'Member Profile Integration',  'buddypress' ); ?></p></li>
 225                          <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
 226                          <li><?php _e( '@ Mention Integration',       'buddypress' ); ?></p></li>
 227                      </ul>
 228  
 229                      <div>
 230                          <a class="button button-primary" href="<?php echo esc_url( $post_url ) . '&step=new' ?>"><?php _e( 'Install Group Forums', 'buddypress' ) ?></a> &nbsp;
 231                          <a class="button" href="<?php echo esc_url( $post_url ) . '&step=existing' ?>"><?php _e( 'Use Existing Installation', 'buddypress' ) ?></a>
 232                      </div>
 233                  </div>
 234  
 235                  <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">
 236                      <h3><?php _e( 'New! bbPress', 'buddypress' ) ?></h3>
 237                      <p><?php _e( 'bbPress is a brand-new forum plugin from one of the lead developers of BuddyPress.', 'buddypress' ) ?></p>
 238  
 239                      <p><?php _e( 'It boasts a bunch of cool features that the BP Legacy Discussion Forums does not have including:', 'buddypress' ) ?></p>
 240  
 241                      <ul class="description" style="list-style: square; margin-left: 30px;">
 242                          <li><?php _e( 'Non-group specific forum creation', 'buddypress' ); ?></p></li>
 243                          <li><?php _e( 'Moderation via the WP admin dashboard', 'buddypress' ); ?></p></li>
 244                          <li><?php _e( 'Topic splitting', 'buddypress' ); ?></p></li>
 245                          <li><?php _e( 'Revisions', 'buddypress' ); ?></p></li>
 246                          <li><?php _e( 'Spam management', 'buddypress' ); ?></p></li>
 247                          <li><?php _e( 'Subscriptions', 'buddypress' ); ?></p></li>
 248                          <li><?php _e( 'And more!', 'buddypress' ); ?></p></li>
 249                      </ul>
 250  
 251                      <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>
 252                      <div>
 253                          <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> &nbsp;
 254                      </div>
 255                  </div>
 256  
 257              <?php }
 258          break;
 259      }
 260  }


Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1