Skip to content
Permalink
Browse files

Fixes, More Options

Fixed issues with some systems causing whitescreen errors. Added
checkboxes for the widgets on desktop.
  • Loading branch information...
djm56 committed Jul 25, 2018
1 parent 885b911 commit 8aa37ea5d68d11508f0a941e605a01a33f9de37c
Showing with 68 additions and 19 deletions.
  1. +3 −3 README.md
  2. +6 −1 admin-customizer-anomalous.php
  3. +22 −10 includes/custom-admin.php
  4. +37 −5 includes/cutom-options.php
@@ -7,18 +7,18 @@ This plugin is used to customize the wp-admin:
1. Copyright text at the bottom of the dashboard
2. Adds a custom dashboard item
3. Logo for login page
4. Removes all Dashboard items.
4. Hide Dashboard items.
5. Select Color for Login Page Background and Font

Version: 1.2.0
Version: 1.3.0

## How to Install

Manual installation:

1. Upload the `wordpress-admin-customizer` folder to the `/wp-content/plugins/` directory

Installation using "Add New Theme"
Installation using "Add New Plugin"

1. From your Admin UI (Dashboard), use the menu to select Plugins -> Add New
2. Click the upload Plugin
@@ -10,7 +10,7 @@
* Plugin Name: WordPress Admin Customizer
* Plugin URI: https://github.com/djm56/WordPress-Admin-Customizer
* Description: Some simple changes to Admin, Login Logo, Admin Copyright and other simple changes.
* Version: 1.2.0
* Version: 1.3.0
* Author: Donovan Maidens
* Author URI: https://wpza.co.za
*/
@@ -51,6 +51,11 @@ public static function activate() {
"wac_text_field_4" => "",
"wac_text_field_5" => "",
"wac_text_field_6" => "",
"wac_text_field_7" => "",
"wac_text_field_8" => "",
"wac_text_field_9" => "",
"wac_text_field_10" => "",
"wac_text_field_11" => "",
);
update_option('wac_settings', $arr);
}
@@ -61,7 +61,7 @@ function remove_footer_admin() {
// Add a widget in WordPress Dashboard
function wpc_dashboard_widget_function() {
$options = get_option('wac_settings');
$optionfield = sanitize_text_field($options['wac_text_field_1']);
$optionfield = $options['wac_text_field_1'];
echo $optionfield;
}
@@ -76,15 +76,27 @@ function wpc_add_dashboard_widgets() {
add_action('wp_dashboard_setup', 'wpc_add_dashboard_widgets');
function remove_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // Right Now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Recent Comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins
remove_meta_box('dashboard_activity', 'dashboard', 'normal'); // Plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress blog
remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Other WordPress News
$options = get_option('wac_settings');
if ($options['wac_text_field_9']) {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // Right Now
}
if ($options['wac_text_field_8']) {
remove_meta_box('dashboard_activity', 'dashboard', 'normal'); // Plugins
}
if ($options['wac_text_field_7']) {
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Press
}
if ($options['wac_text_field_10']) {
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress blog
}
if ($options['wac_text_field_11']) {
remove_action('welcome_panel', 'wp_welcome_panel'); // Welcome Panel
}
// remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Recent Comments
// remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links
// remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins
// remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts
// remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Other WordPress News
// use 'dashboard-network' as the second parameter to remove widgets from a network dashboard.
}
@@ -52,6 +52,9 @@ function wac_settings_init() {
add_settings_field(
'wac_text_field_6', __('Login Font Color', 'wordpress-admin-customizer'), 'wac_text_field_6_render', 'pluginPage', 'wac_pluginPage_section'
);
add_settings_field(
'wac_text_field_7', __('Hide Desktop Widgets', 'wordpress-admin-customizer'), 'wac_text_field_7_render', 'pluginPage', 'wac_pluginPage_section'
);
add_settings_field(
'wac_text_field_3', __('Restore Defaults Upon Reactivation?', 'wordpress-admin-customizer'), 'wac_text_field_3_render', 'pluginPage', 'wac_pluginPage_section'
);
@@ -139,6 +142,35 @@ function wac_text_field_6_render() {
<?php
}
function wac_text_field_7_render() {
$options = get_option('wac_settings');
$checkedone = '';
$checkedtwo = '';
$checkedthree = '';
$checkedfour = '';
$checkedfive = '';
if ($options['wac_text_field_7']) {
$checkedone = ' checked="checked" ';
}
echo "<input " . $checkedone . " id='wac_text_field_7' name='wac_settings[wac_text_field_7]' type='checkbox' /> Hide Quick Draft<br>";
if ($options['wac_text_field_8']) {
$checkedtwo = ' checked="checked" ';
}
echo "<input " . $checkedtwo . " id='wac_text_field_8' name='wac_settings[wac_text_field_8]' type='checkbox' /> Hide Activity<br>";
if ($options['wac_text_field_9']) {
$checkedthree = ' checked="checked" ';
}
echo "<input " . $checkedthree . " id='wac_text_field_9' name='wac_settings[wac_text_field_9]' type='checkbox' /> Hide At A Glance<br>";
if ($options['wac_text_field_10']) {
$checkedfour = ' checked="checked" ';
}
echo "<input " . $checkedfour . " id='wac_text_field_10' name='wac_settings[wac_text_field_10]' type='checkbox' /> Hide WordPress News and Events<br>";
if ($options['wac_text_field_11']) {
$checkedfive = ' checked="checked" ';
}
echo "<input " . $checkedfive . " id='wac_text_field_11' name='wac_settings[wac_text_field_11]' type='checkbox' /> Hide Welcome Panel<br>";
}
function wac_settings_section_callback() {
echo __('Customize this WordPress Install with a custom login logo, and other description\'s and details.', 'wordpress-admin-customizer');
}
@@ -147,11 +179,11 @@ function wac_options_page() {
?>
<form action='options.php' method='post' enctype="multipart/form-data">
<h1>Admin Customizer</h1>
<?php
settings_fields('pluginPage');
do_settings_sections('pluginPage');
submit_button();
?>
<?php
settings_fields('pluginPage');
do_settings_sections('pluginPage');
submit_button();
?>
<p><small>Developed by WPZA Website Maintenance Services. <a href="https://wpza.co.za">https://wpza.co.za</a></small></p>
</form>
<?php

0 comments on commit 8aa37ea

Please sign in to comment.
You can’t perform that action at this time.