Version Description
Download this release
Release Info
Developer | strangerstudios |
Plugin | Hide Admin Bar from Non-Admins |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- hide-admin-bar-from-non-admins.php +33 -0
- readme.txt +26 -0
hide-admin-bar-from-non-admins.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Hide Admin Bar From Non-admins
|
4 |
+
Plugin URI: http://www.paidmembershipspro.com/wp/hide-admin-bar-from-non-admins/
|
5 |
+
Description: A tweak of the code by Yoast to hide the admin bar for non-admins only.
|
6 |
+
Version: 1.0
|
7 |
+
Author: Stranger Studios
|
8 |
+
Author URI: http://www.strangerstudios.com
|
9 |
+
*/
|
10 |
+
/*
|
11 |
+
Copyright 2013 Stranger Studios (email : jason@strangerstudios.com)
|
12 |
+
Licensed under the GPLv2 license: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
+
*/
|
14 |
+
|
15 |
+
function habfna_hide_admin_bar_settings()
|
16 |
+
{
|
17 |
+
?>
|
18 |
+
<style type="text/css">
|
19 |
+
.show-admin-bar {
|
20 |
+
display: none;
|
21 |
+
}
|
22 |
+
</style>
|
23 |
+
<?php
|
24 |
+
}
|
25 |
+
function habfna_disable_admin_bar()
|
26 |
+
{
|
27 |
+
if(!current_user_can('administrator'))
|
28 |
+
{
|
29 |
+
add_filter( 'show_admin_bar', '__return_false' );
|
30 |
+
add_action( 'admin_print_scripts-profile.php', 'habfna_hide_admin_bar_settings' );
|
31 |
+
}
|
32 |
+
}
|
33 |
+
add_action('init', 'habfna_disable_admin_bar', 9);
|
readme.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Hide Admin Bar from Non-Admins ===
|
2 |
+
Contributors: strangerstudios
|
3 |
+
Tags: admin bar, adminbar, dashboard, membership
|
4 |
+
Requires at least: 3.1
|
5 |
+
Tested up to: 4.8.1
|
6 |
+
Stable tag: 1.0
|
7 |
+
|
8 |
+
The WordPress admin bar will be hidden for all non-admin users.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
|
12 |
+
Perfect for sites where there is only one admin who needs access to the dashboard and the admin bar.
|
13 |
+
|
14 |
+
When activated only administrators will see the admin bar.
|
15 |
+
|
16 |
+
This plugin is just a few lines of code. Specifically the line `if(!current_user_can('administrator'))` determines who the admin bar is hidden for. Feel free to edit this to your needs. E.g. using
|
17 |
+
`if(!current_user_can('edit_posts'))` will allow authors to view the admin bar as well.
|
18 |
+
|
19 |
+
This plugin has no settings and will not be updated often, so feel free to edit to your needs.
|
20 |
+
|
21 |
+
== Installation ==
|
22 |
+
|
23 |
+
1. Upload the `hide-admin-bar-from-non-admins` directory to the `/wp-content/plugins/` directory of your site.
|
24 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
25 |
+
1. Tweak the plugin code as needed. There are no settings, and this plugin will not be updated oftne.
|
26 |
+
|