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

I have finished implement SSO in Question2Answer, however, I really want it to get avatar and show it here:

How can I do that?

Q2A version: 1.7.4

1 Answer

+3 votes
by
selected by
 
Best answer

1. Edit file qa-theme/SnowFlat/qa-theme.php

2. Add/Merge the following function:

public function initialize() {
    parent::initialize();
    if ($this->template === 'user') {
        $handle = qa_request_part(1);
        $userid = qa_handle_to_userid($handle);
        $this->content['form_profile'] = array(
            'tags' => 'method="post" action="' . qa_self_html() . '"',
            'style' => 'wide',
            'fields' => array(
                'avatar' => array(
                    'type' => 'image',
                    'style' => 'tall',
                    'label' => '',
                    'html' => qa_get_external_avatar_html($userid, qa_opt('avatar_profile_size'), false),
                    'id' => 'avatar',
                ),
            ),
        );
    }
    qa_array_reorder($this->content, array('form_profile', 'form_activity'), null, true);
}

Note that, obviously, you will have to implement the qa_get_external_avatar_html() function in your external-users file.

It should look like this:

by
Thank you a lot @pupi1985. You save the day!
...