• Resolved arypneta

    (@arypneta)


    We’ve noticed an issue for a while where some avatar images have been deleted. Just the underlying file is being deleted, but the media library entry was not. So we’d have images that didn’t actually exist or load, but still with an entry in the media library.

    It wasn’t happening super frequently, so it was hard to pinpoint, but I think I’ve finally tracked down the cause (and was able to replicate on a new install of WordPress with a default WP theme and just this plugin active).

    From my testing, this happens when a new avatar is selected (or any other time the avatar_delete function is called). I believe the purpose of the avatar_delete function is to delete any extra registered image sizes (if the image is no longer being used as an avatar).

    However, if for some reason one of the local avatar array sizes points to the original file url, the original file url is deleted (which leads to the broken media library shell). In get_simple_local_avatar_url, it seems that the default file path is to the full file, which is often replaced by the resized file, but not always.

    One way that seemed reproducible was if the original image was the exact same size as one of the gravatar sizes (I tested with a 192px square as an example).

    To me, it seems like one easy way to stop this from happening would be to compare the original file path/url to any of the registered sizes before deleting (to make sure the original file is not deleted). Thanks in advance for your help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Peter Wilson

    (@peterwilsoncc)

    Hi @arypneta and thank you so much for your report.

    If you have a GitHub account, are you able to open an issue in the repository, this will help insure that we give you appropriate credit when working on the fix.

    Let me know if you don’t have a GitHub account, in which case I am happy to open a ticket on your behalf.

    Thread Starter arypneta

    (@arypneta)

    I don’t have a GitHub account currently, so it would be great if you could open the ticket for me. Thanks so much!

    Plugin Support Peter Wilson

    (@peterwilsoncc)

    No worries, I’ve opened 10up/simple-local-avatars#372 to track the issue.

    Thanks again for letting us know of the bug.

    Thread Starter arypneta

    (@arypneta)

    Great, thanks! I’ll keep an eye out there for a resolution.

    Thread Starter arypneta

    (@arypneta)

    Any update on when this might be fixed? It’s still causing issues for us. I haven’t seen any activity on the GitHub issue.

    I think the easiest place to fix it would be the avatar_delete function in the SimpleLocalAvatars class (class-simple-local-avatars.php). Just save the full path if it exists and compare to make sure you aren’t deleting the full path when you unlink old avatars.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.