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

I am trying to include my avatar in my profile...

I was expecting something like a space to insert my url gravatar address or that the gravatar arose automatically based on my email address. One of the two things happens here... Either , when I press the button it goes to gravatar.com: http://pt.gravatar.com/ or If I only check the radio button, it presents the default avatar.

Furthermore, I tried to find a function similar to

qa_set_user_avatar($userId, file_get_contents($selectedAvatarFilePath), null);

to deal with gravatars and I was not able to find it. The only thing that I found was

qa_get_gravatar_html($email, $size) that generates gravatars and as far as I know it is used here (account.php):

        if (qa_opt('avatar_allow_gravatar')) {
            $avataroptions['gravatar']='<span style="margin:2px 0; display:inline-block;">'.
                qa_get_gravatar_html($useraccount['email'], 32).' '.strtr(qa_lang_html('users/avatar_gravatar'), array(
                    '^1' => '<a href="http://www.gravatar.com/" target="_blank">',
                    '^2' => '</a>',
                )).'</span>';

            if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_GRAVATAR)
                $avatarvalue=$avataroptions['gravatar'];
        }

However, I am not sure if it is working as expected.

 

Q2A version: 1.7.0

1 Answer

+1 vote
by
selected by
 
Best answer

I'm not actually understanding the issue you're getting. The profile displays the matching avatar for your email address. This happens if you have allowed Gravatar and the user has selected Gravatar for displaying their avatar.

The function that generates de HTML img tag with the Gravatar hash is here: https://github.com/q2a/question2answer/blob/3ea14aef81c6c5a0fe192ae083fffd03daa254b8/qa-include/app/format.php#L1983

You don't seem to have Gravatar enabled in your profile but you can take a look at mine and check the generated HTML:

<a href="../user/pupi1985" class="qa-avatar-link">
    <img src="http://www.gravatar.com/avatar/080d24e21f0b0e02a1a9805122473755?s=250" width="250" height="250" class="qa-avatar-image" alt="">
</a>

by
Thank you again for your clarification. Yes, I allowed gravatars in my site. I think here in my country we are not used to dealing with Gravatars yet. Now I understand the objective of it. I was expecting something different like an identicon, such as stackoverflow.
...