[ Index ]

MailPress 7.2

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

title

Body

[close]

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

   1  <?php
   2  
   3  if ( !( function_exists( 'current_user_can' ) && current_user_can( MP_AdminPage::capability ) ) ) die( 'Access denied' );
   4  
   5  global $mp_subscriptions;
   6  
   7  //
   8  // MANAGING H1
   9  //
  10  
  11  $h1 =  __( 'Manage Subscriptions', 'MailPress' );
  12  
  13  //
  14  // MANAGING SUBSCRIPTIONS
  15  //
  16  
  17  $email    = MP_WP_User::get_email();
  18  $mp_user    = MP_User::get( MP_User::get_id_by_email( $email ) );
  19  $active     = ( 'active' == $mp_user->status ) ? true : false;
  20  
  21  if ( isset( MP_AdminPage::$pst_['formname'] ) && ( 'sync_wordpress_user_subscriptions' == MP_AdminPage::$pst_['formname'] ) )
  22  {
  23      if ( $mp_user->name != MP_AdminPage::$pst_['mp_user_name'] )
  24      {
  25          MP_User::update_name( $mp_user->id, MP_AdminPage::$pst_['mp_user_name'] );
  26          $mp_user->name = stripslashes( MP_AdminPage::$pst_['mp_user_name'] );
  27      }
  28  
  29      if ( class_exists( 'MailPress_comment' ) )                    MailPress_comment::update_checklist( $mp_user->id );
  30      if ( class_exists( 'MailPress_newsletter' ) )  if ( $active )     MailPress_newsletter::update_checklist( $mp_user->id );
  31      if ( class_exists( 'MailPress_mailinglist' ) ) if ( $active )     MailPress_mailinglist::update_checklist( $mp_user->id );
  32  
  33      $message = __( 'Subscriptions saved', 'MailPress' );
  34  }
  35  
  36  $checklist_comments = $checklist_mailinglists = $checklist_newsletters = false;
  37  if ( class_exists( 'MailPress_comment' ) )                    $checklist_comments     = MailPress_comment::get_checklist( $mp_user->id );
  38  if ( class_exists( 'MailPress_newsletter' ) )  if ( $active )     $checklist_newsletters  = MailPress_newsletter::get_checklist( $mp_user->id );
  39  if ( class_exists( 'MailPress_mailinglist' ) ) if ( $active )    $checklist_mailinglists = MailPress_mailinglist::get_checklist( $mp_user->id );
  40  ?>
  41  <div class="wrap">
  42      <h1>
  43          <?php echo esc_html( $h1 ); ?>
  44      </h1>
  45  <?php if ( isset( $message ) ) MP_AdminPage::message( $message ); ?>
  46      <form id="posts-filter" method="post">
  47  
  48          <input type="hidden" name="page" value="<?php echo MailPress_page_subscriptions; ?>" />
  49          <input type="hidden" name="formname" value="sync_wordpress_user_subscriptions" />
  50  
  51          <table class="form-table">
  52              <tr>
  53                  <th><?php _e( 'Email', 'MailPress' ); ?></th>
  54                  <td>
  55                      <input type="text" value="<?php echo $mp_user->email; ?>" disabled="disabled"/>
  56                  </td>
  57              </tr>
  58              <tr>
  59                  <th><?php _e( 'Name', 'MailPress' ); ?></th>
  60                  <td>
  61                      <input type="text" name="mp_user_name" value="<?php echo esc_attr( $mp_user->name ); ?>" class="regular-text" />
  62                  </td>
  63              </tr>
  64  <?php if ( $checklist_comments ) : $ok = true; ?>
  65              <tr>
  66                  <th><?php _e( 'Comments' ); ?></th>
  67                  <td>
  68                      <?php echo $checklist_comments; ?>
  69                  </td>
  70              </tr>
  71  <?php endif; ?>     
  72  <?php if ( $checklist_newsletters ) : $ok = true; ?>
  73              <tr>
  74                  <th><?php _e( 'Newsletters', 'MailPress' ); ?></th>
  75                  <td>
  76                      <?php echo $checklist_newsletters; ?>
  77                  </td>
  78              </tr>
  79  <?php endif; ?>     
  80  <?php if ( $checklist_mailinglists ) : $ok = true; ?>
  81              <tr>
  82                  <th><?php _e( 'Mailing lists', 'MailPress' ); ?></th>
  83                  <td>
  84                      <?php echo $checklist_mailinglists; ?>
  85                  </td>
  86              </tr>
  87  <?php endif; ?>
  88          </table>
  89  <?php if ( isset( $ok ) ) : ?> 
  90          <p class="submit">
  91              <input type="submit" name="Submit" class="button-primary" value="<?php  _e( 'Save', 'MailPress' ); ?>" />
  92          </p>
  93  <?php else : ?> 
  94          <p>
  95  <?php 
  96          if ( $active )     _e( 'Nothing to subscribe for ...', 'MailPress' );
  97          else            _e( 'Your email has been deactivated, ask the administrator ...', 'MailPress' );
  98  ?>
  99          </p>
 100  <?php endif; ?> 
 101      </form>
 102  </div>


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1