Comments (6)
I see that in your plugin, the function that creates the update checker instances is attached to the admin_init
hook. Could it be that MainWP performs updates in a context where the admin_init
hook doesn't get triggered? In that case, the updates wouldn't show up because the update checker wouldn't have been initialized.
I'm not sure if that could also affect the numbers in the admin menu. Still, as a test, it might be worth moving the functions to a much earlier hook, like plugins_loaded
.
from plugin-update-checker.
If you want to control when exactly PUC checks for updates, one way would be to pass 0
as the fourth argument to buildUpdateChecker()
. This argument is the "check period", and setting it to zero disables automatic checks. Then you can have your plugin trigger update checks directly by calling the $updateChecker->checkForUpdates()
method.
Note that you will still need to initialize the update checker on other pages, or the updates won't show up in the admin.
from plugin-update-checker.
This was perfect, it was so tiny I would never have worked it out thank you;
I now need to work out how to get it to run 4 times a day for updates and that should be it done now thanks again
from plugin-update-checker.
it's running every single time and every single page I am running in my admin area, any suggestions on how to limit it to only plugins and updates or Ideally, 4 times a day for it to run and the updates be there for the twice-daily WordPress check is enough for me, I suspect this will work for the 4 times a day but I am not sure how to restrict where it runs.
`
// Activation hook
/register_activation_hook(FILE, 'ninja_updater_schedule_tasks');
// Deactivation hook
register_deactivation_hook(FILE, 'ninja_updater_deactivate');
add_action( 'ninja_updater_check_plugins', 'ninja_updater_check_plugins' );
add_action( 'ninja_updater_check_themes', 'ninja_updater_check_themes' );/
function ninja_custom_cron_schedule( $schedules ) {
$schedules['every_six_hours'] = array(
'interval' => 21600, // Every 6 hours
'display' => __( 'Every 6 hours' ),
);
return $schedules;
}
add_filter( 'cron_schedules', 'ninja_custom_cron_schedule' );
function ninja_updater_schedule_tasks() {
error_log('ninja_updater_schedule_tasks has been executed at ' . date('Y-m-d H:i:s')); // Add this line for debugging
if (!wp_next_scheduled('ninja_updater_check_plugins')) {
// Schedule plugin check every 6 hours
wp_schedule_event(time(), 'every_six_hours', 'ninja_updater_check_plugins');
}
if (!wp_next_scheduled('ninja_updater_check_themes')) {
// Schedule theme check every 6 hours
wp_schedule_event(time(), 'every_six_hours', 'ninja_updater_check_themes');
}
}
// On Deactivate
function ninja_updater_deactivate() {
// Remove the scheduled events for checking plugins and themes
wp_clear_scheduled_hook('ninja_updater_check_plugins');
wp_clear_scheduled_hook('ninja_updater_check_themes');
}
`
Thanks Again
from plugin-update-checker.
Thanks I think I understood but I think I've done something wrong now I get no checking at all, the modifications I made are here
https://github.com/stingray82/ninja-updater-pd/
You can see the commit here:
stingray82/ninja-updater-pd@9030db1
I will take another look this evening, thanks again for you help
from plugin-update-checker.
$updateChecker
was a placeholder. In practice, you of course need to call checkForUpdates()
on your actual update checker instance(s). Also, as I mentioned, you'll need to pass a zero as the 4th argument to buildUpdateChecker()
. The third argument is the slug, but you can use an empty string if you want PUC to automatically assign a slug.
from plugin-update-checker.
Related Issues (20)
- Release assets fallback to first/default .zip even if releaseassets regex is applied. HOT 5
- Plugin not found HOT 5
- Disable Update Mechanism / Hooks for License Management HOT 8
- 404 Issue when Updating (Fine grained tokens?) HOT 2
- enableReleaseAssets() no longer the supported method HOT 5
- Error PUC 5.1 does not support GitHub in ... HOT 13
- Question about translations HOT 2
- PHP 8.2 Compatibility - Deprecation Notice HOT 3
- "Can't to read the plugin header" errors HOT 2
- Deprecated error HOT 2
- Deprecation notices PHP8 HOT 3
- Unable to check version HOT 7
- Using PUC on an external server HOT 2
- Fatal error: Uncaught Error: Class 'YahnisElsts\PluginUpdateChecker\v5p1\DebugBar\Panel' not found HOT 11
- API for self update function HOT 11
- Fatal Error: Unable to determine if plugin or theme HOT 7
- Add query arg to requested .php file HOT 4
- Exclude repo file when updating my plugin HOT 1
- Not seeing "Install Update Now" button in plugin details popup HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-update-checker.