Changeset 2065999
- Timestamp:
- 04/09/2019 06:19:18 PM (7 years ago)
- Location:
- wp-admin-bar-control/trunk
- Files:
-
- 3 edited
-
includes/admin.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-admin-bar-control.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-admin-bar-control/trunk/includes/admin.php
r2064138 r2065999 45 45 ,'style' => 'group' 46 46 ,'hidePlugins' => array() 47 ,'hideRoles' => array() 47 48 ,'custom' => array() 48 49 ,'custom_pos' => 0 … … 70 71 ,'style' => $_POST['style'] 71 72 ,'hidePlugins' => $_POST['hidePlugins'] 73 ,'hideRoles' => $_POST['hideRoles'] 72 74 ,'custom' => !empty($_POST['custom']) ? $_POST['custom'] : '' 73 75 ,'custom_pos' => !empty($_POST['custom_pos']) ? $_POST['custom_pos'] : 0 … … 90 92 $input['style'] = wp_filter_post_kses( $input['style'] ); 91 93 $input['hidePlugins'] = wp_filter_nohtml_kses( $input['hidePlugins'] ); 94 $input['hideRoles'] = wp_filter_nohtml_kses( $input['hideRoles'] ); 92 95 $input['custom'] = wp_filter_post_kses( $input['custom'] ); 93 96 $input['custom_pos'] = wp_filter_post_kses( $input['custom_pos'] ); … … 137 140 <label for="hideBar-no"><?php _e('Hide Admin Bar for', 'yabp')?>:</label> 138 141 <?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 ' <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 ?> 139 165 <input type="checkbox" name="hideBarWPAdmin" id="hideBarWPAdmin" value="1" <?php checked( $yabp['hideBarWPAdmin'], 1 ); ?>> <label for="hideBarWPAdmin"><?php _e('Admin page', 'yabp') ?></label><br> 140 166 <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> 141 167 <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> 142 168 <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*/ ?> 144 170 145 171 <?php echo $beforeRow ?> … … 582 608 // /Удаление значков WP и ссылок в админбаре 583 609 584 if( $yabp['hideBar'] == 'user' && !current_user_can( 'manage_options' ) || $yabp['hideBar'] == 'all' )585 show_admin_bar( false );586 610 587 611 if( $yabp['hideBarWPAdmin'] == 1 ) 588 612 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 589 625 590 626 function hide_wp_admin_bar() { -
wp-admin-bar-control/trunk/readme.txt
r2064136 r2065999 8 8 Requires at least: 3.3 9 9 Tested up to: 5.1.1 10 Stable tag: 0.9. 210 Stable tag: 0.9.3 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 44 44 == Changelog == 45 46 = 0.9.3 = 47 * Added all user roles to check 45 48 46 49 = 0.9.2 = -
wp-admin-bar-control/trunk/wp-admin-bar-control.php
r2064136 r2065999 3 3 Plugin Name: WP Admin Bar Control 4 4 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. 25 Version: 0.9.3 6 6 Author: Alex Egorov 7 7 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.