[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-admin/ -> options-reading.php (source)

   1  <?php
   2  
   3  require_once ( 'admin.php' );
   4  
   5  if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') {
   6      
   7      bb_check_admin_referer( 'options-reading-update' );
   8      
   9      foreach ( (array) $_POST as $option => $value ) {
  10          if ( !in_array( $option, array('_wpnonce', '_wp_http_referer', 'action', 'submit') ) ) {
  11              $option = trim( $option );
  12              $value = is_array( $value ) ? $value : trim( $value );
  13              $value = stripslashes_deep( $value );
  14              if ( $value ) {
  15                  bb_update_option( $option, $value );
  16              } else {
  17                  bb_delete_option( $option );
  18              }
  19          }
  20      }
  21      
  22      $goback = add_query_arg('updated', 'true', wp_get_referer());
  23      bb_safe_redirect($goback);
  24      exit;
  25  }
  26  
  27  if ( !empty( $_GET['updated'] ) )
  28      bb_admin_notice( '<strong>' . __( 'Settings saved.' ) . '</strong>' );
  29  
  30  $reading_options = array(
  31      'page_topics' => array(
  32          'title' => __( 'Items per page' ),
  33          'class' => 'short',
  34          'note' => __( 'Number of topics, posts or tags to show per page.' )
  35      ),
  36      'name_link_profile' => array(
  37          'title' => __( 'Link name to' ),
  38          'type' => 'radio',
  39          'options' => array(
  40              0 => __( 'Website' ),
  41              1 => __( 'Profile' )
  42          ),
  43          'note' => __( 'What should the user\'s name link to on the topic page? The user\'s title would automatically get linked to the option you don\'t choose. By default, the user\'s name is linked to his/her website.' )
  44      )
  45  );
  46  
  47  $bb_admin_body_class = ' bb-admin-settings';
  48  
  49  bb_get_admin_header();
  50  
  51  ?>
  52  
  53  <div class="wrap">
  54  
  55  <h2><?php _e( 'Reading Settings' ); ?></h2>
  56  <?php do_action( 'bb_admin_notices' ); ?>
  57  
  58  <form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-reading.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
  59      <fieldset>
  60  <?php
  61  foreach ( $reading_options as $option => $args ) {
  62      bb_option_form_element( $option, $args );
  63  }
  64  ?>
  65      </fieldset>
  66      <fieldset class="submit">
  67          <?php bb_nonce_field( 'options-reading-update' ); ?>
  68          <input type="hidden" name="action" value="update" />
  69          <input class="submit" type="submit" name="submit" value="<?php _e( 'Save Changes' ) ?>" />
  70      </fieldset>
  71  </form>
  72  
  73  </div>
  74  
  75  <?php
  76  
  77  bb_get_admin_footer();


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