Title: Problem with SSL
Last modified: August 22, 2016

---

# Problem with SSL

 *  [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/)
 * This plugin works very nicely on posts and pages loading on http. Thank you!
 * Unfortunately, it’s causing a problem when posts or pages (or admin pages) load
   on https. It seems that this plugin has hardcoded all uploaded avatars to load
   using http, which then causes “mixed content” warnings.
 * Would it be possible for you to modify the code so that avatars load on https
   when SSL is set for that particular post or page?
 * [https://wordpress.org/plugins/basic-user-avatars/](https://wordpress.org/plugins/basic-user-avatars/)

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

 *  Plugin Author [Jared Atchison](https://wordpress.org/support/users/jaredatch/)
 * (@jaredatch)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689024)
 * Good call. I don’t have a specific time line for a fix but this is something 
   I will look into when I can.
 *  Thread Starter [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689044)
 * Thank you, Jared, for considering this.
 *  Thread Starter [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689263)
 * Jared,
 * It seems that the fundamental problem is a long-standing bug in WordPress: see
   [this](https://core.trac.wordpress.org/ticket/25449) and the other tickets to
   which it refers.
 * I haven’t found that any of the workarounds mentioned there helps at all. But
   I have found that adding a couple of functions to `functions.php` seems to overcome
   the problem.
 * I took the inspiration from [here](http://wordpress.stackexchange.com/questions/84046/how-to-change-the-wp-upload-dir-path-in-plugin),
   and came up with this:
 *     ```
       function wpse_84046_upload_path( $path ) {
           return 'wp-content/uploads';
       }
       add_filter( 'pre_option_upload_path', 'wpse_84046_upload_path' );
   
       function wpse_84046_upload_path_url( $url ) {
           return 'wp-content/uploads';
       }
       add_filter( 'pre_option_upload_path_url', 'wpse_84046_upload_path_url' );
       ```
   
 * Although it’s obviously still using the same uploads folder as before, some avatars
   may need to be re-uploaded after making this change. But, once that’s done, it
   all works with SSL (when that is set) without causing mixed content warnings.
 * I don’t know whether this is something you might integrate into the plugin.
 *  Plugin Author [Jared Atchison](https://wordpress.org/support/users/jaredatch/)
 * (@jaredatch)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689264)
 * Good find.
 * I’m thinking maybe the best thing as a short term fix is putting a filter in 
   place, what when manually set to true, which forces HTTPS on the front end even
   if it’s through a less than ideal approach `str_replace()`.
 * Thoughts?
 *  Thread Starter [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689265)
 * Jared,
 * You’re right that it’s a less than ideal approach, but I can’t think of anything
   better, given that the problem lies within WordPress itself.
 * I think that, if I were convinced that the next WordPress update would solve 
   the problem, then I’d probably be inclined to suggest that you just wait it out.
 * But, because the fixes and workarounds suggested in the various Trac tickets 
   don’t work for me, I am far from convinced. I think your proposed “short term
   fix” might actually turn out to be useful for quite a while!
 *  Plugin Author [Jared Atchison](https://wordpress.org/support/users/jaredatch/)
 * (@jaredatch)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689266)
 * Actually, I just realized there is already a filter in place (`basic_user_avatar`)
   that runs when the custom avatar is output [http://cl.ly/image/0i2q032C1G0R](http://cl.ly/image/0i2q032C1G0R)
 * This isn’t an elegant approach, but I’d probably just run whatever checks you
   see fit for your use case (is_ssl, is_admin, whatever) then do the string replace
   when necessary via that filter. Hopefully that will work for now. Let me know.
 *  Thread Starter [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689267)
 * OK, that makes sense. Thanks!
 *  [StorkWEB](https://wordpress.org/support/users/storkweb/)
 * (@storkweb)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689326)
 * Hi,
 * I’ve found this solution, and it works :
 * in init.php on line 186 add `set_url_scheme()` around the `$local_avatars[$size]`
   like that :
 * `$avatar = "<img alt='" . esc_attr( $alt ) . "' src='" . <strong>set_url_scheme(
   </strong>$local_avatars[$size]<strong>)</strong> . "' class='avatar avatar-{$
   size}{$author_class} photo' height='{$size}' width='{$size}' />";`
 * it adds http or https depending on the is_ssl() value.
 *  Plugin Author [Jared Atchison](https://wordpress.org/support/users/jaredatch/)
 * (@jaredatch)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689327)
 * Thanks. This is on my radar!
 * [https://github.com/jaredatch/Basic-User-Avatars/issues/12](https://github.com/jaredatch/Basic-User-Avatars/issues/12)

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

The topic ‘Problem with SSL’ is closed to new replies.

 * ![](https://ps.w.org/basic-user-avatars/assets/icon-256x256.png?rev=2560641)
 * [Basic User Avatars](https://wordpress.org/plugins/basic-user-avatars/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/basic-user-avatars/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/basic-user-avatars/)
 * [Active Topics](https://wordpress.org/support/plugin/basic-user-avatars/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/basic-user-avatars/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/basic-user-avatars/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [Jared Atchison](https://wordpress.org/support/users/jaredatch/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/problem-with-ssl-1/#post-5689327)
 * Status: not resolved