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

i'm trying to show the persons avatar of who made the question in the front page,I tried to add this

$this->output('<DIV CLASS="qa-q-item-stats">');
$this->post_avatar($q_item, 'qa-q-item');
$this->output('</DIV>');
In  function q_item_main($q_item)  but it's not working... can somebody help me?
Q2A version: 1.6.3

1 Answer

+2 votes
by

in $q_item array you will get user's information. than you can use qa_get_user_avatar_html() function to output the avatar. Something like below







// get require data 
$flags        = $q_item['raw']['flagcount']; 
$email        = $q_item['raw']['email']; 
$handle       = $q_item['raw']['handle']; 
$avatarblobid = $q_item['raw']['avatarblobid']; 
$avatarwidth  = $q_item['raw']['avatarwidth']; 
$avatarheight = $q_item['raw']['avatarheight']; 

// output user avatar 
qa_get_user_avatar_html($flags, $email, $handle, $avatarblobid, $avatarwidth, $avatarheight, 52, false );
by
I couldn't be able to make it.. :s
Do I put this inside of this??

function q_item_main($q_item)
        {
            $this->output('<DIV CLASS="qa-q-item-main">');
            $this->q_item_title($q_item);
            $this->q_item_content($q_item);
            $this->output('<DIV CLASS="qa-q-item-meta">');
            $this->a_count($q_item);
            $this->output('</DIV>');
            $this->output('<DIV class="qa-q-item-meta">');
            $this->output(
                '<SPAN CLASS="qa-view-count-data">',
                $this->short_num($q_item['raw']['views']),
                '</SPAN>'
            );
            $this->output('<span class="qa-view-count-pad">views</span>');
            $this->output('</DIV>');
            $this->post_meta($q_item, 'qa-q-item');
            $this->post_tags($q_item, 'qa-q-item');
            $this->q_item_buttons($q_item);
            $this->output('</DIV>');
        }
by
it would work there - yes...
...