Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline "check for theme updates" #569

Open
Milosh911 opened this issue Mar 20, 2024 · 1 comment
Open

Streamline "check for theme updates" #569

Milosh911 opened this issue Mar 20, 2024 · 1 comment

Comments

@Milosh911
Copy link

Milosh911 commented Mar 20, 2024

It sucks that we need debug bar plugin to check for updates. The way I streamlined it (quick and dirty) is to add new admin bar link:

<?php $wp_admin_bar->add_node( array( 'id' => 'theme-check-for-update', 'title' => 'Check for update', 'parent' => 'theme-version', 'href' => '/wp-admin/themes.php?check_for_updates=true&secret=SECRET_CODE', 'meta' => array( 'class' => 'theme-check-for-update', 'title' => 'Check for update', ) ) );?>

and check in functions.php (right after the buildUpdateChecker from documentation

require get_template_directory().'/backend/vendor/plugin-update-checker/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
$myUpdateChecker = PucFactory::buildUpdateChecker(
'URL',
get_template_directory()."/functions.php",
'SLUG'
);
if($_GET['check_for_updates'] && $_GET['secret'] == SECRET_CODE){
$myUpdateChecker->checkForUpdates();
}

Again quick and dirty but it works for my needs. Since its so simple I think it should be available natively in plugin itself, as there are many use cases where people want to trigger update check manually.

Edit: sorry for code formatting, new on github issues and it's not very intuitive on how to do it...

@YahnisElsts
Copy link
Owner

I'd rather not change the WordPress admin UI any more than necessary. That's one of the reasons why all of the debugging info is only in the Debug Bar, not in a separate admin page or a widget. PUC is intended to be nearly invisible to end-users.

That said, you're of course welcome to add an Admin Bar/Toolbar link in your theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants