I'd like to know if there's any way to hook into WordPress update process and send $_POST
variable to update server?
I'm delivering plugin/theme updates from private server and I hook into this:
add_filter('pre_set_site_transient_update_themes', 'check_for_update');
which works just fine. Newer version of theme/plugin appears under Dashboard > Updates and I can update. But the problem is - I want users to only be able to download/update if they provided correct login/password (first via add_option()
). Ideally, direct link should never work unless client sends $_POST
with login/password to update.php (the files on update server that will send plugin.ZIP in return).
I'm looking for something like this:
add_filter('updating', 'my_func');
function my_func($request){
$request['login'] = get_option('login');
$request['pass'] = get_option('pass');
return $request;
}
And WordPress, while updating theme/plugin, should send $_POST['login']
and $_POST['pass']
to http://example.com/update.php and update.php should only allow downloading/updating if login matches the one defined there (update.php is the file on update server that sends ZIP package with newer plugin to WordPress).
I hope that it's clear :)
function check_for_update($checked_data) { return $checked_data; }
- you can add more themes/plugins to$checked_data
and they can come from private servers. I also managed to resolve this issue already in a bit different way :) There are tutorials out there on that subject and they are of great help here.