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

How can i display the number of questions a user asked?

0 votes
106 views
asked Jun 2, 2016 in Q2A Core by Frodo
CAn someone advice me how to display the number of questions a user has right below his avatar image on Question page ???

Regards
Q2A version: 1.6.x

1 Answer

+2 votes
answered Jun 7, 2016 by Scott

This data is stored in the meta-table qa_userpoints. The qposts columns has the number of questions they have asked. So a query like this would do it:

$result = qa_db_query_sub('SELECT qposts FROM ^userpoints WHERE userid=#', $userid);
$qposts = qa_db_read_one_value($result, true);

$userid there might be $post['raw']['userid'] instead, if the query was run in one of the theme functions.

...