Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
900 views
in Themes by
edited by

After installing the Donut theme for Q2A version 1.80 the avatar of the logged in user which is shown on the top right of the page is always blank. How to fix it?

Q2A version: 1.8

2 Answers

+2 votes
by

I found the solution myself:

open the \qa-theme\Donut-theme\utils\qa-donut-utils.php file and replace the code

 function donut_get_user_avatar( $userid, $size = 40 )
    {
        if ( !defined( 'QA_WORDPRESS_INTEGRATE_PATH' ) ) {
            $useraccount = qa_db_select_with_pending( qa_db_user_account_selectspec( $userid, true ) );
            $user_avatar = qa_get_user_avatar_html( $useraccount['flags'], $useraccount['email'], null,
                $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], $size );
        } else {
            $user_avatar = qa_get_external_avatar_html( $userid, qa_opt( 'avatar_users_size' ), true );
        }
        if ( empty( $user_avatar ) ) {
            // if the default avatar is not set by the admin , then take the default
            $user_avatar = donut_get_default_avatar( $size );
        }
        return $user_avatar;
    }

with this one:

function qa_get_user_avatar_img($flags, $email, $handle, $blobId, $width, $height, $size, $padding = false)

{

if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }

require_once QA_INCLUDE_DIR . 'app/format.php';

if (strlen($handle) == 0) {

return null;

}

$avatarSource = qa_get_user_avatar_source($flags, $email, $blobId);

switch ($avatarSource) {

case 'gravatar':

$html = qa_get_gravatar_html($email, $size);

break;

case 'local-user':

$html = qa_get_avatar_blob_html($blobId, $width, $height, $size, $padding);

break;

case 'local-default':

$html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding);

break;

default: // NULL

return null;

}

return $html;

}

 function donut_get_user_avatar( $userid, $size = 40 )

    {

        if ( !defined( 'QA_WORDPRESS_INTEGRATE_PATH' ) ) {

            $useraccount = qa_db_select_with_pending( qa_db_user_account_selectspec( $userid, true ) );

            $user_avatar = qa_get_user_avatar_img( 

$useraccount['flags'],

$useraccount['email'],

$useraccount['handle'],

$useraccount['avatarblobid'],

$useraccount['avatarwidth'],

$useraccount['avatarheight'],

$size,

false

);

        } else {

            $user_avatar = qa_get_external_avatar_html( $userid, qa_opt( 'avatar_users_size' ), true );

        }

        if ( empty( $user_avatar ) ) {

            // if the default avatar is not set by the admin , then take the default

            $user_avatar = donut_get_default_avatar( $size );

        }

        return $user_avatar;

    }

 Solved!

+1 vote
by
This has been resolved in new version of Donut theme. You should not face this issue anymore.
...