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

Hi to all of you.

I am trying to add the number of questions of each user inside the subnav bar in the user profile page. This is what i did until now.

I opened the file qa-include/qa-app-format.php and added the code:

'Posts' => array(
                
                'label' => qa_lang_html('profile/questions'),
                'value' => '<span class="qa-uf-user-q-posts">'.qa_html(number_format(@$userpoints['qposts'])).' Posts'.'</span>',
                'id' => 'questions',
            ),

However it displays only the label (questions) and not the number of the member's questions as you can see in the image below. What is wrong on the code?

1 Answer

0 votes
by
selected by
 
Best answer
I think this is what you're looking for:
 
function qa_user_sub_navigation($handle, $selected, $ismyuser=false) {
    $result = qa_db_select_with_pending(qa_db_user_points_selectspec($handle));
 
    $navigation=array(
        'profile' => array(
            'label' => qa_lang_html_sub('profile/user_x', qa_html($handle)),
            'url' => qa_path_html('user/'.$handle),
        ),
 
        .... blah ....
 
        'posts' => array(
            'label' => qa_lang_html('profile/questions') . '<span class="qa-uf-user-q-posts">' . $result['qposts'] . ' Posts </span>',
            'id' => 'questions',
        ),
    );
    .... blah ....
by
Thanks pupi1985 it works fine :)
...