Proposed Fix for Occasional Error Log Entries
-
Your plugin is great as I’ve been using it for the past few years on my multisite installation that currently has version 1.20.3.1 installed. I have a suggestion for two simple changes I’ve made on the file classes/import.php to prevent occasional error log entries and provide more robust error handling. Please consider making the following changes in a future update.
**** Improved error handling that prevents white screen on wp_die *****
Line 218 import.php change from:
wp_die( __( 'Error, we cannot find the file', 'import-users-from-csv-with-meta' ) . ": $path_to_file" );
Line 218 import.php change to the following and insert additional lines:
if ( !$_FILES['uploadfile']['name']) echo "<script>alert('No file was selected');</script><meta http-equiv='refresh' content='0'>"; if ( $_FILES['uploadfile']['name']) echo '<br><h3><b>Refresh the page when ready, or navigate to another desired page</b></h3><input type="button" value="Refresh" onClick="window.location.href=window.location.href">'; exit;
**** Eliminates error log entry on blank or invalid email but shows on screen error *****
Line 567 import.php change from:
$user_id = wp_create_user( $username, $password, $email );
to the following:
if( !empty( $email ) && ( ( sanitize_email( $email ) !== '' ) ) ) $user_id = wp_create_user( $username, $password, $email ); // prevent insertion of blank or invalid email
- The topic ‘Proposed Fix for Occasional Error Log Entries’ is closed to new replies.