Support » Plugin: WP User Avatar » FIX: media.php on line 647 – non-numeric value

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello,
    Thank you very much for your contribution to make this product more useful.

    Thanks

    Thank you so much!

    I just downloaded this plugin today and I’m getting the same error.

    Warning: A non-numeric value encountered in /<path-to-wp-install>/wp-includes/media.php on line 647 Warning

    diskoremote

    (@diskoremote)

    Hi, please can I have the solution to this problem? I did not understand where I have to correct the code

    This error is shown on profile page in WP Admin on my installation.

    WPChina

    (@wordpresschina)

    Hello, I too am facing this same error. I saw the github fix but I’m unclear how to add it or where to add it and what to add?

    Open the file

    /wp-content/plugins/wp-user-avatar/includes/class-wp-user-avatar-functions.php

    Then look for the function

    public function wpua_get_avatar_original($id_or_email=””, $size=””, $default=””, $alt=””)

    and exchange the code with this:

    public function wpua_get_avatar_original($id_or_email="", $size="", $default="", $alt="") {
        global $avatar_default, $mustache_avatar, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions;
        // Remove get_avatar filter
        remove_filter('get_avatar', array($wpua_functions, 'wpua_get_avatar_filter'));
        if((bool) $wpua_disable_gravatar != 1) {
          // User doesn't have Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
          if(!$wpua_functions->wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar') {
            // Show custom Default Avatar
            if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
             // $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
    			$size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) );	
    			$wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h);	
    	 
              $default = $wpua_avatar_default_image[0];
            } else {
              $default = $mustache_avatar;
            }
          } else {
            // Get image from Gravatar, whether it's the user's image or default image
            $wpua_image = get_avatar($id_or_email, $size);
            // Takes the img tag, extracts the src
            $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
            $default = !empty($matches) ? $matches [0] [1] : "";
          }
        } else {
          if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
    //      $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
    				$size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) );
    				$wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h);
    
            $default = $wpua_avatar_default_image[0];
          } else {
            $default = $mustache_avatar;
          }
        }
        // Enable get_avatar filter
        add_filter('get_avatar', array($wpua_functions, 'wpua_get_avatar_filter'), 10, 5);
        /**
         * Filter original avatar src
         * @since 1.9
         * @param string $default
         */
        return apply_filters('wpua_get_avatar_original', $default);
      }
    WPChina

    (@wordpresschina)

    Works! Thank you very much.

    actronab

    (@actronab)

    This bug is still not fixed, even though a solution was provided?

    Is that bugfix only included in the Pro version?

    WPChina

    (@wordpresschina)

    The plugin developer just issued an update to 2.1.6. However, after upgrading to 2.1.6 I still see the error. So I needed to patch the file again.

    Maybe the developer is not reading this forum?

    it is still not fixed!

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.