Plugin Directory

Changeset 2065999


Ignore:
Timestamp:
04/09/2019 06:19:18 PM (7 years ago)
Author:
evilex
Message:

ver 0.9.3

Location:
wp-admin-bar-control/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-admin-bar-control/trunk/includes/admin.php

    r2064138 r2065999  
    4545      ,'style' => 'group'
    4646      ,'hidePlugins' => array()
     47      ,'hideRoles' => array()
    4748      ,'custom' => array()
    4849      ,'custom_pos' => 0
     
    7071        ,'style' => $_POST['style']
    7172        ,'hidePlugins' => $_POST['hidePlugins']
     73        ,'hideRoles' => $_POST['hideRoles']
    7274        ,'custom' => !empty($_POST['custom']) ? $_POST['custom'] : ''
    7375        ,'custom_pos' => !empty($_POST['custom_pos']) ? $_POST['custom_pos'] : 0
     
    9092      $input['style'] = wp_filter_post_kses( $input['style'] );
    9193      $input['hidePlugins'] = wp_filter_nohtml_kses( $input['hidePlugins'] );
     94      $input['hideRoles'] = wp_filter_nohtml_kses( $input['hideRoles'] );
    9295      $input['custom'] = wp_filter_post_kses( $input['custom'] );
    9396      $input['custom_pos'] = wp_filter_post_kses( $input['custom_pos'] );
     
    137140          <label for="hideBar-no"><?php _e('Hide Admin Bar for', 'yabp')?>:</label>
    138141        <?php echo $betweenRow ?>
     142          <input type="checkbox" name="hideBarWPAdmin" id="hideBarWPAdmin" value="1" <?php checked( $yabp['hideBarWPAdmin'], 1 ); ?>> <label for="hideBarWPAdmin"><?php _e('Admin page only', 'yabp') ?></label><br>
     143          <b><?php _e('Roles', 'yabp') ?>:</b><br/>
     144          <?php
     145            $all_roles = get_editable_roles(); //error_log( print_r( $all_plugins, true ) );
     146            foreach ($all_roles as $url => $role) {
     147              $role_str = preg_replace('/\s+/', '_', strtolower($role['name']));
     148              $hide = empty($yabp['hideRoles'][$role_str]) ? '' : $yabp['hideRoles'][$role_str];
     149              echo '&nbsp;<label><input type="checkbox" id="'.$role_str.'" name="hideRoles['.$role_str.']" value="'.$role_str.'" '.checked( $hide, $role_str, false).' "/> '.$role['name'].'</label><br>';
     150            }
     151          ?>
     152          <?php /*_e('Current user roles', 'yabp') ?>:<br/>
     153          <?php $current_user_roles = wp_get_current_user();
     154            echo '<b>'.$current_user_roles->data->user_nicename.'</b><br/>';
     155            foreach ($current_user_roles->roles as $k => $role) {
     156              echo $role.'<br/>';
     157            }
     158          */ ?>
     159        <?php echo $afterRow ?>
     160
     161
     162        <?php /*echo $beforeRow ?>
     163          <label for="hideBar-no"><?php _e('Hide Admin Bar for', 'yabp')?>:</label>
     164        <?php echo $betweenRow ?>
    139165          <input type="checkbox" name="hideBarWPAdmin" id="hideBarWPAdmin" value="1" <?php checked( $yabp['hideBarWPAdmin'], 1 ); ?>> <label for="hideBarWPAdmin"><?php _e('Admin page', 'yabp') ?></label><br>
    140166          <input type="radio" name="hideBar" id="hideBar-all" value="all" <?php checked( $yabp['hideBar'], 'all' ); ?>> <label for="hideBar-all"><?php _e('Admins and Users', 'yabp') ?></label><br>
    141167          <input type="radio" name="hideBar" id="hideBar-user" value="user" <?php checked( $yabp['hideBar'], 'user' ); ?>> <label for="hideBar-user"><?php _e('Users only', 'yabp') ?></label><br>
    142168          <input type="radio" name="hideBar" id="hideBar-no" value="no" <?php checked( $yabp['hideBar'], 'no' ); ?>> <label for="hideBar-no"><?php _e('No one', 'yabp') ?></label><br>
    143         <?php echo $afterRow ?>
     169        <?php echo $afterRow*/ ?>
    144170
    145171        <?php echo $beforeRow ?>
     
    582608  // /Удаление значков WP и ссылок в админбаре
    583609
    584   if( $yabp['hideBar'] == 'user' && !current_user_can( 'manage_options' ) || $yabp['hideBar'] == 'all' )
    585     show_admin_bar( false );
    586610
    587611  if( $yabp['hideBarWPAdmin'] == 1 )
    588612    add_action( 'admin_enqueue_scripts', 'hide_wp_admin_bar' );
     613
     614  $current_user_roles = wp_get_current_user();
     615  //prr($yabp['hideRoles']);
     616  //prr($current_user_roles->roles);
     617  if(isset($yabp['hideRoles'])){
     618    if(!empty(array_intersect($current_user_roles->roles,$yabp['hideRoles'])))
     619      add_action( 'admin_enqueue_scripts', 'hide_wp_admin_bar' );
     620  }
     621
     622  // if( $yabp['hideBar'] == 'user' && !current_user_can( 'manage_options' ) || $yabp['hideBar'] == 'all' )
     623  //   show_admin_bar( false );
     624
    589625
    590626  function hide_wp_admin_bar() {
  • wp-admin-bar-control/trunk/readme.txt

    r2064136 r2065999  
    88Requires at least: 3.3
    99Tested up to: 5.1.1
    10 Stable tag: 0.9.2
     10Stable tag: 0.9.3
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4343
    4444== Changelog ==
     45
     46= 0.9.3 =
     47* Added all user roles to check
    4548
    4649= 0.9.2 =
  • wp-admin-bar-control/trunk/wp-admin-bar-control.php

    r2064136 r2065999  
    33  Plugin Name: WP Admin Bar Control
    44  Description: Style Admin Bar. Add Plugins list to your Admin Bar. Activate and Deactivate plugins without page reload and moving to plugins page.
    5     Version: 0.9.2
     5    Version: 0.9.3
    66  Author: Alex Egorov
    77    Author URI: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SLHFMF373Z9GG&source=url
Note: See TracChangeset for help on using the changeset viewer.