[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-admin/includes/ -> users.php (source)

   1  <?php
   2  
   3  if ( !( function_exists( 'current_user_can' ) && current_user_can( MP_AdminPage::capability ) ) ) die( 'Access denied' );
   4  
   5  do_action( 'MailPress_users_addon_update' );
   6  
   7  $url_parms = MP_AdminPage::get_url_parms( array( 'status', 's', 'paged', 'author', 'mailinglist', 'newsletter', 'startwith' ) );
   8  
   9  //
  10  // MANAGING H1
  11  //
  12  
  13  $h1 = __( 'Users', 'MailPress' );
  14  $subtitle = '';
  15  
  16  if ( isset( $url_parms['startwith'] ) ) 
  17  {
  18      $subtitle .= ' ' . sprintf( __( 'starting with &#8220;%s&#8221;', 'MailPress' ), $url_parms['startwith'] );
  19  }
  20  if ( isset( $url_parms['newsletter'] ) && !empty( $url_parms['newsletter'] ) ) 
  21  {
  22      $newsletter = MP_Newsletter::get( $url_parms['newsletter'] );
  23      $subtitle .= ' ' . sprintf( __( 'in &#8220;%s&#8221;', 'MailPress' ), esc_html( $newsletter['descriptions']['admin'] ) );
  24  }
  25  if ( isset( $url_parms['mailinglist'] ) && !empty( $url_parms['mailinglist'] ) ) 
  26  {
  27      $mailinglist = MP_Mailinglist::get( $url_parms['mailinglist'] );
  28      $subtitle .= ' ' . sprintf( __( 'in &#8220;%s&#8221;', 'MailPress' ), esc_html( $mailinglist->name ) );
  29  }
  30  if ( isset( $url_parms['author'] ) ) 
  31  {
  32      $author_user = get_userdata( $url_parms['author'] );
  33      $subtitle .= ' ' . sprintf( __( 'by %s' ), esc_html( $author_user->display_name ) );
  34  }
  35  
  36  //
  37  // MANAGING MESSAGE / CHECKBOX RESULTS
  38  //
  39  
  40  $results = array(    'activated'    =>     array(     's' => __( '%s subscriber activated', 'MailPress' ),  
  41                                          'p' => __( '%s subscribers activated', 'MailPress' )
  42                                  ),
  43                  'deactivated'    =>    array(     's' => __( '%s subscriber deactivated', 'MailPress' ),
  44                                          'p' => __( '%s subscribers deactivated', 'MailPress' )
  45                                  ),
  46                  'unbounced'    =>     array(     's' => __( '%s subscriber unbounced', 'MailPress' ),
  47                                          'p' => __( '%s subscribers unbounced', 'MailPress' )
  48                                  ),
  49                  'deleted'        =>     array(     's' => __( '%s subscriber deleted', 'MailPress' ),
  50                                          'p' => __( '%s subscribers deleted', 'MailPress' )
  51                                  ),
  52                  'geolocated'    =>     array(     's' => __( '%s subscriber geolocated', 'MailPress' ), 
  53                                          'p' => __( '%s subscribers geolocated', 'MailPress' )
  54                                  ),
  55   );
  56  
  57  foreach ( $results as $k => $v )
  58  {
  59      if ( isset( MP_AdminPage::$get_[$k] ) && MP_AdminPage::$get_[$k] )
  60      {
  61          if ( !isset( $message ) ) 
  62          {
  63              $message = '';
  64          }
  65          $message .= sprintf( _n( $v['s'], $v['p'], MP_AdminPage::$get_[$k] ), MP_AdminPage::$get_[$k] );
  66          $message .=  '<br />';
  67      }
  68  }
  69  
  70  //
  71  // MANAGING BULK ACTIONS
  72  //
  73  
  74  $bulk_actions[''] = __( 'Bulk Actions' );
  75  if ( isset( $url_parms['status'] ) )
  76  {
  77      switch( $url_parms['status'] )
  78      {
  79          case 'waiting' :
  80              $bulk_actions['activate']  = __( 'Activate', 'MailPress' );
  81          break;
  82          case 'unsubscribed' :
  83              $bulk_actions['deactivate']= __( 'Deactivate', 'MailPress' );
  84          break;
  85          case 'active' :
  86              $bulk_actions['deactivate']= __( 'Deactivate', 'MailPress' );
  87          break;
  88          case 'bounced' :
  89              $bulk_actions['unbounce']  = __( 'Unbounce', 'MailPress' );
  90          break;
  91      }
  92  }
  93  if ( current_user_can( 'MailPress_delete_users' ) ) $bulk_actions['delete'] = __( 'Delete', 'MailPress' );
  94  
  95  //
  96  // MANAGING LIST
  97  //
  98  
  99  $url_parms['paged'] = isset( $url_parms['paged'] ) ? $url_parms['paged'] : 1;
 100  $_per_page = MP_AdminPage::get_per_page();
 101  
 102  do
 103  {
 104      $start = ( $url_parms['paged'] - 1 ) * $_per_page;
 105      list( $items, $total, $subsubsub_urls ) = MP_AdminPage::get_list( array( 'start' => $start, '_per_page' => $_per_page, 'url_parms' => $url_parms ) );
 106      $url_parms['paged']--;        
 107  } while ( $total <= $start );
 108  $url_parms['paged']++;
 109  
 110  ?>
 111  <div class="wrap">
 112      <h1>
 113          <?php echo esc_html( $h1 ); ?>
 114          <!-- <a id="new_mp_user" href="" class="add-new-h2"><?php echo esc_html( __( 'Add New', 'MailPress' ) ); ?></a> -->
 115  <?php if ( isset( $url_parms['s'] ) ) printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_attr( $url_parms['s'] ) ); ?>
 116  <?php if ( !empty( $subtitle ) )      echo    '<span class="subtitle">' . $subtitle . '</span>'; ?>
 117      </h1>
 118  <?php if ( isset( $message ) ) MP_AdminPage::message( $message ); ?>
 119  
 120      <ul class="subsubsub"><?php echo $subsubsub_urls; ?></ul>
 121  
 122      <form id="posts-filter" method="get">
 123          <input type="hidden" name="page" value="<?php echo MP_AdminPage::screen; ?>" />
 124  <?php MP_AdminPage::post_url_parms( $url_parms, array( 'mode', 'status', 'author', 'mailinglist', 'newsletter' ) ); ?>
 125  
 126          <p class="search-box">
 127              <input type="text" name="s" class="search-input" value="<?php if ( isset( $url_parms['s'] ) ) echo esc_attr( $url_parms['s'] ); ?>" />
 128              <input type="submit" class="button" value="<?php _e( 'Search', 'MailPress' ); ?>" />
 129          </p>
 130  <?php 
 131  if ( $items )
 132  {
 133  ?>
 134          <div class="tablenav top">
 135              <div class="alignleft actions bulkactions">
 136  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions ); ?>
 137              </div>
 138              <div class="alignleft actions">
 139  <?php do_action( 'MailPress_users_restrict',$url_parms ); ?>
 140                  <input type="submit" id="restrict" class="button-secondary" value="<?php echo esc_attr( __( 'Filter', 'MailPress' ) ); ?>" />
 141              </div>
 142  
 143  <?php MP_AdminPage::pagination( $total ); ?>
 144  
 145              <br class="clear" />
 146          </div>
 147          <div class="clear"></div>
 148  
 149          <table class="wp-list-table widefat fixed striped zyxw">
 150              <thead>
 151                  <tr>
 152  <?php MP_AdminPage::columns_list(); ?>
 153                    </tr>
 154              </thead>
 155              <tbody id="the-user-list" class="list:user">
 156  <?php foreach ( $items as $item ) { echo MP_AdminPage::get_row( $item->id, $url_parms ); } ?>
 157              </tbody>
 158              <tfoot>
 159                  <tr>
 160  <?php MP_AdminPage::columns_list( false ); ?>
 161                    </tr>
 162              </tfoot>
 163          </table>
 164          <div class="tablenav bottom">
 165  <?php MP_AdminPage::pagination( $total, 'bottom' ); ?>
 166              <div class="alignleft actions bulkactions">
 167  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions, 'action2' ); ?>
 168              </div>
 169              <br class="clear" />
 170          </div>
 171      </form>
 172  
 173      <form id="get-extra-users" method="post" class="hidden add:the-extra-user-list:">
 174  <?php MP_AdminPage::post_url_parms( ( array ) $url_parms ); ?>
 175  <?php wp_nonce_field( 'add-user', '_ajax_nonce', false ); ?>
 176      </form>
 177  
 178      <div id="ajax-response"></div>
 179  
 180  <?php
 181  }
 182  else
 183  {
 184  ?>
 185      </form>
 186      <div class="clear"></div>
 187      <p>
 188          <?php _e( 'No results found.', 'MailPress' ) ?>
 189      </p>
 190  <?php
 191  }
 192  ?>
 193  <?php do_action( 'MailPress_users_addon',$url_parms ); ?>
 194  </div>


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1