Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
2.4k views
in Q2A Core by
Any idea will help. :)

thanks

3 Answers

+2 votes
by
edited by
 
Best answer
You can use this PHP to get the top users:

global $qa_db;
$users=qa_db_single_select($qa_db, qa_db_top_users_selectspec(0));

In more detail, you want the something like the following in the qa-theme.php file in your theme:

<?php

    class qa_html_theme extends qa_html_theme_base
    {
        function sidepanel()
        {
            global $qa_db;

            qa_html_theme_base::sidepanel();

            $users=qa_db_single_select($qa_db, qa_db_top_users_selectspec(0));

            foreach ($users as $user)
                $this->output('<P>'.qa_get_one_user_html($user['handle'], false).
                    ' ('.number_format($user['points']).')</P>');
        }
    }

?>
by
How would you access the sidebar though? Like through the qa-theme.php? That would be helpful for me. thank you.
by
Gidgreen, I would need one more hint where to put this code. I allready understand what to do with an array and how to use the advanced theme, but still need this hint.

Thanks so much

monk333
by
Use an advanced HTML theme to override the theme function sidepanel() or sidebar() as appropriate for the placement. Don't forget to call the default theme function (using :: notation) if you still want it to show up.
by
Thanks again, I tried it in many ways, but there is something I always make wrong. If You have five minutes, couldn´t You explain it with more detail please ? Which code goes where ?
Best regards
monk
by
I've now added a more detailed answer above.
by
Oh, thank You so much ! I will try it now and I hope I will make it without asking again.

Best regards

monk
by
It works perfectly !! Thanks again ! Have to do some minor adjustments later, but it is really great. I wonder how long You needed to write that down ?
by
In the above code, instead of sidepanel, if we choose sidebar that works perfectly...
by
edited by
Thank you for your code-example!
unfortunately I get the following error:

Warning: Invalid argument supplied for foreach() in ...\XAMPP\htdocs\q2a\qa-include\qa-db.php on line 308

Question2Answer query failed:

SELEC

Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELEC' at line 1

any ideas?

--> edited 08.12.2010 :

Solution:
For version 1.3 the function qa_db_single_select changed:
-->  delete the $qa_db

instead of:
$users=qa_db_single_select($qa_db, qa_db_top_users_selectspec(0));
use:
$users=qa_db_single_select(qa_db_top_users_selectspec(0));

:)

[ see this post: http://www.question2answer.org/qa/3309/problem-with-function-qa_db_single_select#a3311 ]
+4 votes
by
edited by

I created a widget that shows top 10user on sidebar for q2aV1.4. It is available for download here

If you have any question, pm me. See demo here

asked Jul 14, 2011 in Q2A Core by anonymous problem with the installing the plugin
by
Solution:

1. In qa-top-user.php change string from: qa_lang_html('addon/top_user'),
to: qa_lang_html('misc/top_user'),

2. open \qa-lang\qa-lang-misc.php and add in the end (within the array):
'top_user' => 'Top Users',

3. save and upload to your server.
by
@tenkana: It seems that you updated your plugin. In the plugin available for download there are no avatars. On your site there are avatars showing up.

Would you mind uploading the new version? Thank you.
+1 vote
by

You can use either:

• Plugin Best Users per Month

or

• Plugin Most Active Users per Week or Month

...