﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
20716,Control how and when request_filesystem_credentials outputs creds form,griffinjt,,"When using WP_Filesystem in a plugin or other external app, you can initialize it this way:

{{{
if ( false == ( $creds = request_filesystem_credentials( $url, $method, false, false, $form_fields ) ) ) {
    return true;
}
}}}

Makes sense. If the method isn't direct or we don't have the credentials we need, `request_filesystem_credentials` outputs a form and returns false. Then we check again to make sure the credentials can be verified, and it not, we continue to output the form until the credentials are good.

{{{
if ( ! WP_Filesystem( $creds ) ) {
    request_filesystem_credentials( $url, $method, true, false, $form_fields );
    return true;
}
}}}

`request_filesystem_credentials` arbitrarily outputs the form whether you want it to or not, unless you explicitly filter the `request_filesystem_credentials` function itself. Using this in conjunction with Ajax, you have to use output buffering to catch the output and return it to the Ajax script for processing or else you get errors. This definitely isn't ideal.

I'd suggest storing the form in a variable and possibly pass a parameter that determines whether or not we want to actually output the form or not. Or, if there is another (better) way, that's cool too. Just some way to help `request_filesystem_credentials` determine how we want to interact with credentials should we need them.

",enhancement,new,normal,Awaiting Review,Filesystem,3.4,normal,,reporter-feedback,
