Skip to content

Commit

Permalink
Merge pull request #12 from capuderg/master
Browse files Browse the repository at this point in the history
Added error messages for credentials when using WP_Filesystem.
  • Loading branch information
primozcigler committed Dec 18, 2015
2 parents 265a1df + 9d98dfb commit e3bd695
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions importer/wordpress-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,14 @@ function fetch_remote_file( $url, $post ) {
// get user credentials for WP filesystem API
$demo_import_page_url = wp_nonce_url( 'themes.php?page=radium_demo_installer', 'radium_demo_installer' );
if ( false === ( $creds = request_filesystem_credentials( $demo_import_page_url, '', false, false, null ) ) ) {
return true;
return new WP_Error( 'import_file_error', esc_html__('Your credentials are not valid.', 'radium') );
}

// now we have credentials, try to get the wp_filesystem running
if ( ! WP_Filesystem( $creds ) ) {
// our credentials were no good, ask the user for them again
request_filesystem_credentials( $demo_import_page_url, '', true, false, null );
return true;
return new WP_Error( 'import_file_error', esc_html__('Your credentials are not valid.', 'radium') );
}

// by this point, the $wp_filesystem global should be working, so let's use it to create a file
Expand Down

0 comments on commit e3bd695

Please sign in to comment.