Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
bcc9f984f6 | |||
db662096e4 | |||
d6b89887fc |
23
CHANGELOG.md
23
CHANGELOG.md
@ -2,6 +2,29 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.3.3] - 2023-10-05
|
||||
### Added
|
||||
- "Click here to scroll" button to automatically find missing plugins
|
||||
- Visual arrow pointing from notification to error message
|
||||
- Smooth scrolling with highlighting of missing plugin rows
|
||||
|
||||
### Improved
|
||||
- Notification reliability using multiple injection methods
|
||||
- Earlier placement in page load cycle for better visibility
|
||||
- Enhanced error detection for all WordPress error message formats
|
||||
|
||||
## [1.3.2] - 2023-10-05
|
||||
### Added
|
||||
- Prominent notification that appears directly below WordPress error messages
|
||||
- Visual styling to help users connect error message with solution
|
||||
- Direction arrows and highlighted text to improve user guidance
|
||||
|
||||
## [1.3.1] - 2023-10-05
|
||||
### Added
|
||||
- Instructional notification explaining how to use the plugin
|
||||
- Step-by-step guidance for removing plugin references
|
||||
- Clear visual indicators for missing plugins
|
||||
|
||||
## [1.3.0] - 2023-10-05
|
||||
### Changed
|
||||
- Complete redesign for maximum compatibility with all WordPress themes
|
||||
|
18
README.md
18
README.md
@ -1,7 +1,7 @@
|
||||
# Plugin Reference Cleaner
|
||||
Author: Marcus Quinn
|
||||
Author URI: https://www.wpallstars.com
|
||||
Version: 1.3.0
|
||||
Version: 1.3.3
|
||||
License: GPL-2.0+
|
||||
|
||||
## Description
|
||||
@ -47,6 +47,22 @@ If you don't have this notification perpetually showing on your /wp-admin/plugin
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.3.3
|
||||
* Improved notification placement next to WordPress error messages
|
||||
* Added "Click here to scroll" button that automatically locates missing plugins
|
||||
* Enhanced reliability with multiple injection methods
|
||||
* Added visual arrow pointing from notification to error message
|
||||
|
||||
### 1.3.2
|
||||
* Added prominent notification directly below WordPress error messages
|
||||
* Improved user guidance with visual cues to connect error and solution
|
||||
* Added eye-catching styling to help users understand how to fix errors
|
||||
|
||||
### 1.3.1
|
||||
* Added instructional notification explaining how to use the plugin
|
||||
* Improved user guidance with step-by-step instructions
|
||||
* Enhanced visual identification of missing plugins
|
||||
|
||||
### 1.3.0
|
||||
* Complete redesign for maximum compatibility with all WordPress themes
|
||||
* Now adds missing plugins directly to the plugins list table
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Plugin Name: Plugin Reference Cleaner
|
||||
* Description: Adds a "Remove Reference" button to plugin deactivation error notices, allowing users to clean up invalid plugin entries.
|
||||
* Version: 1.3.0
|
||||
* Version: 1.3.3
|
||||
* Author: Marcus Quinn
|
||||
* Author URI: https://www.wpallstars.com
|
||||
* License: GPL-2.0+
|
||||
@ -150,6 +150,125 @@ class Plugin_Reference_Cleaner {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get invalid plugins
|
||||
$invalid_plugins = $this->get_invalid_plugins();
|
||||
|
||||
// Create a highlighted notice immediately after WordPress error messages
|
||||
if (!empty($invalid_plugins)) {
|
||||
// Add a notice specifically targeting the WordPress error notification
|
||||
// Use admin_head to ensure it runs early in the page load process
|
||||
add_action('admin_head', function() use ($invalid_plugins) {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.prc-notice {
|
||||
border-left: 4px solid #ffba00;
|
||||
background-color: #fff8e5;
|
||||
padding: 10px 12px;
|
||||
margin: 5px 0 15px;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
}
|
||||
.prc-notice h3 {
|
||||
margin-top: 0;
|
||||
color: #826200;
|
||||
}
|
||||
.prc-notice::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: 20px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 10px solid transparent;
|
||||
border-right: 10px solid transparent;
|
||||
border-bottom: 10px solid #fff8e5;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
// Function to inject our notice
|
||||
function injectNotice() {
|
||||
// Find all notification containers first
|
||||
var noticeContainers = document.querySelectorAll('.notice, .error, .updated');
|
||||
|
||||
// Find all error notifications about missing plugins
|
||||
noticeContainers.forEach(function(notice) {
|
||||
if (notice.textContent.includes('Plugin file does not exist') ||
|
||||
notice.textContent.includes('has been deactivated due to an error')) {
|
||||
|
||||
// Check if we already added our notice
|
||||
if (notice.nextElementSibling && notice.nextElementSibling.classList.contains('prc-notice')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create our custom notice
|
||||
var ourNotice = document.createElement('div');
|
||||
ourNotice.className = 'prc-notice';
|
||||
|
||||
// Add content
|
||||
ourNotice.innerHTML = '<h3 style="margin-top:0;color:#826200;">👉 Plugin Reference Cleaner Can Fix This</h3>' +
|
||||
'<p>To remove the above error notification, scroll down to find the plugin marked with "<strong style="color:red">(File Missing)</strong>" and click its "<strong>Remove Reference</strong>" link.</p>' +
|
||||
'<p>This will permanently remove the missing plugin reference from your database.</p>' +
|
||||
'<p><a href="#" id="prc-scroll-to-plugin" style="font-weight:bold;text-decoration:underline;color:#826200;">Click here to scroll to the missing plugin</a></p>';
|
||||
|
||||
// Insert our notice right after the error
|
||||
notice.parentNode.insertBefore(ourNotice, notice.nextSibling);
|
||||
|
||||
// Add scroll behavior
|
||||
var scrollLink = document.getElementById('prc-scroll-to-plugin');
|
||||
if (scrollLink) {
|
||||
scrollLink.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
var missingPlugins = document.querySelectorAll('tr.inactive:not(.plugin-update-tr)');
|
||||
for (var i = 0; i < missingPlugins.length; i++) {
|
||||
if (missingPlugins[i].textContent.includes('(File Missing)')) {
|
||||
missingPlugins[i].style.backgroundColor = '#fff8e5';
|
||||
missingPlugins[i].scrollIntoView({behavior: 'smooth', block: 'center'});
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Try to inject notices on multiple events to ensure it works
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
injectNotice();
|
||||
|
||||
// Also set up a MutationObserver to watch for dynamically added notices
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
|
||||
injectNotice();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Start observing the body for changes
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
|
||||
// Backup attempt with window.onload
|
||||
window.onload = function() {
|
||||
setTimeout(injectNotice, 500);
|
||||
};
|
||||
|
||||
// Final backup in case other methods fail
|
||||
setTimeout(injectNotice, 1000);
|
||||
</script>
|
||||
<?php
|
||||
});
|
||||
|
||||
// Also display our standard info notice with more details
|
||||
echo '<div class="notice notice-info is-dismissible">';
|
||||
echo '<h3>Plugin Reference Cleaner</h3>';
|
||||
echo '<p><strong>Missing plugin files detected:</strong> The plugins listed below with <span style="color:red;">(File Missing)</span> tag no longer exist but are still referenced in your database.</p>';
|
||||
echo '<p><strong>How to fix:</strong> Click the "Remove Reference" link next to each missing plugin to safely remove it from your active plugins list.</p>';
|
||||
echo '<p>This will clean up your database and remove the error notifications.</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// Show success message
|
||||
if (isset($_GET['reference_removed']) && $_GET['reference_removed'] === '1') {
|
||||
echo '<div class="notice notice-success is-dismissible"><p>Plugin reference removed successfully.</p></div>';
|
||||
|
18
readme.txt
18
readme.txt
@ -1,7 +1,7 @@
|
||||
=== Plugin Reference Cleaner ===
|
||||
Author: Marcus Quinn
|
||||
Author URI: https://www.wpallstars.com
|
||||
Version: 1.3.0
|
||||
Version: 1.3.3
|
||||
License: GPL-2.0+
|
||||
|
||||
== Description ==
|
||||
@ -47,6 +47,22 @@ If you don't have this notification perpetually showing on your /wp-admin/plugin
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.3.3 =
|
||||
* Improved notification placement next to WordPress error messages
|
||||
* Added "Click here to scroll" button that automatically locates missing plugins
|
||||
* Enhanced reliability with multiple injection methods
|
||||
* Added visual arrow pointing from notification to error message
|
||||
|
||||
= 1.3.2 =
|
||||
* Added prominent notification directly below WordPress error messages
|
||||
* Improved user guidance with visual cues to connect error and solution
|
||||
* Added eye-catching styling to help users understand how to fix errors
|
||||
|
||||
= 1.3.1 =
|
||||
* Added instructional notification explaining how to use the plugin
|
||||
* Improved user guidance with step-by-step instructions
|
||||
* Enhanced visual identification of missing plugins
|
||||
|
||||
= 1.3.0 =
|
||||
* Complete redesign for maximum compatibility with all WordPress themes
|
||||
* Now adds missing plugins directly to the plugins list table
|
||||
|
Reference in New Issue
Block a user