As the main administrator of the site that is using DW Focus, I changed my password and at the same time uploaded a new profile pic. When I saved the changes, all admin screen content areas went blank. The only thing left on the admin pages is the left hand menu. There is no way to access anything through the dashboard and admin screens.
The public display area of the site is still visible, but there is no admin bar at the top of the screen, as there was before I made the changes. Looking in the server logs, I see the following warning:
[Thu Apr 03 15:41:46.961257 2014] [:error] [pid 1883] PHP Fatal error: Call to undefined method WP_Error::resize() in /var/www/<MySiteName>/html/content/themes/dw-focus_1.0.7_theme/inc/simple-avatar.php on line 50, referer: <MySiteName>/wp/wp-admin/options-general.php
(This is a staging site that is not available to the public. I replaced the staging name with <MySiteName> in the error log above.)
I have no way to access the admin area to fix this. Is there a solution for this issue? — Mark
If you replace, in inc/simple_avatar.php
$image = wp_get_image_editor( $avatar_full_path );
$image_sized = $image->resize( $size, $size, true );
// deal with original being >= to original image (or lack of sizing ability)
$local_avatars[$size] = is_wp_error($image_sized) ? $local_avatars[$size] = $local_avatars[‘full’] : str_replace( $upload_path[‘basedir’], $upload_path[‘baseurl’], $image_sized );
with
$image_editor_test_args = array(
‘methods’ => array(
‘resize’,
‘save’
)
);
if ( wp_image_editor_supports( $image_editor_test_args ) ) { //checks image editor support
$image = wp_get_image_editor( $avatar_full_path );
$image->resize( $size, $size, true );
$image_name = $image->generate_filename();
$image_sized = $image->save($image_name);
// deal with original being >= to original image (or lack of sizing ability)
$local_avatars[$size] = is_wp_error($image_sized) ? $local_avatars[$size] = $local_avatars[‘full’] : str_replace( $upload_path[‘basedir’], $upload_path[‘baseurl’], $image_name );
} else {
$local_avatars[$size] = $local_avatars[‘full’];
}
That should fix the error with the local avatar system breaking the layout. I had an issue withe author page not working when a profile image was uploaded. The problem was that the original code would try to use the results of the resize() method in a variable and did not fail gracefully if that did not work.
Please download the file that @ BigHug provided above, then just follow his guideline to update and fix the bugs as well.
The answer link.
The fix displays an empty image in the case where the server is able to save the uploaded avatar image but not save the resized images. The urls saved in the database for the resized urls, in this case, are ” “.
Please make sure your upload folder allows saving images created by WordPress
That’s not always possible on a server environment you don’t control. There’s no harm in having a default image in case there’s an issue with creating the resized image.
Thank you for the responses. I have been working on another site, but will implement the lastest DW Focus theme to fix this issue.
Please login or Register to submit your answer
replied 11 years ago
To be clear, the change in password worked, so I have access to the admin area. There just isn’t anything visible in the content area of the screen.
replied 11 years ago
After some research, this turns out to be a user profile issue. Another admin of the site was able to log in, see the admin screens and change the theme back to the default that came with the WP installation. I logged in and all the admin screens were visible in my profile. When I changed the theme back to DW Focus, again all the admin screens disappeared.
I had the other admin change back to the default theme again. I then created a back up admin and password combination, reverted to the DW Focus theme and was then able to admin the site from that account.
This is a high priority bug in that putting in a user profile pic could make it impossible to administrate the site. I recommend that you create a back up admin/password combination just in case this happens to you.
I’d still like to see a fix in the next theme update, but it doesn’t look like anyone from DW has seen this thread.
replied 10 years ago
I also have this problem, but not second admin account to help fix it! Any suggestions?
replied 10 years ago
I copied this little bit of code
if (!is_wp_error($image)) {
$image->resize(100, 100, false);
$image->save($target);
return “succ”;
} else return “error”;
from http://wordpress.stackexchange.com/questions/83400/using-wp-get-image-editor-in-a-standalone-script
into the simple-avatar.php file right after the line of code defining $image.
and it brought my dashboard back to life. (Whew!!) Instead of an avatar, I have “error.” I then checked the box to delete my avatar image and saved. Everything is copacetic if we don’t use avatar images. Uhmm… yeah.
I’m still interested in a fix for this bug. Thanks!