Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Big avatar in SSO Integration?

+4 votes
69 views
asked Jan 31 in Q2A Core by Bùi Lê Chí Bảo

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
answered Feb 1 by pupi1985
selected Feb 9 by Bùi Lê Chí Bảo
 
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:

commented Feb 9 by Bùi Lê Chí Bảo
Thank you a lot @pupi1985. You save the day!
...