I recently asked a question about an error I was getting for doing theme updates where the user did not have permission. I would like to write a credential check, much like how wordpress does theirs.

essentially when you update WordPress you either have the worlds most insecure set up and it will just update when you click the button or it will do the smart thing and ask you for your ftp credentials.

My theme is built on the same concept except I don't know how to ask you for your ftp credentials. Now I know there are wordpress functions that do the update of themes for you, except I check my version number in a custom way, I also get the zip from my hosting and I don't use wordpress theme repo for any of this, so the one quick fix function won't work.

So my question is:

How do you write a custom credential check function that basically checks if you need ftp or not.

  • Is this a one-site only event? Is your intention to control only the theme update? Do those users have administrator roles (I suppose so)? What update method are you using? – brasofilo Mar 15 '13 at 16:28
  • figured it out. – TheWebs Mar 15 '13 at 17:00
  • 2
    Well, share the solution! – brasofilo Mar 15 '13 at 17:00
  • A good starting point would be reverse engineering get_filesystem_method from wp-admin/includes/file.php – vancoder Mar 15 '13 at 17:04
  • 2
    I really don't see how my suggestion of a starting point relating to checking FTP details could be called "wrong". But, as you appear to be unwilling to share any answers here, I guess we'll never know. – vancoder Mar 15 '13 at 18:38

simple function:

    protected function _cred_check(){
    $aisis_file_system_structure = WP_Filesystem();
    if($aisis_file_system_structure == false){
        echo '<div class="alert"><strog>NOTE!</strong> We need your ftp creds before we continue!</div>';
        return true;

    return false;

then do:

}else{ // your update stuff }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.