Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
in Plugins by
edited by

This is a plugin that displays all the questions and answers of a user! It adds links under Recent Activity and next to the questions and answers count on a user page.

The lists are paginated like normal question lists; it picks up the number from the "Questions page length" option. Answers use a similar design to question lists but also shows a snippet of the answer. Both lists include the class `qa-a-count-selected` where applicable for appropriate styling of selected answers.

It's available here: https://github.com/svivian/q2a-user-activity-plus
(Click 'ZIP' at the top to download the package.)


  • Language file now included for easy translation to other languages.
  • Option to include the CSS inline on the page (IMO it's still preferable to put it in your global CSS).
  • 404 error for non-existent users.

Let me know what you think! Please submit any bugs/problems as Issues on Github so I can more easily keep track of them. Thanks.

Do you have a link to an example page where the issue occurs?
yeah,the website with this plugin installed : http://1.weiboqa.sinaapp.com/index.php?qa=ask
Then you can also see the website has all the same code expect user-activity-plugin:

This bug also can be found in question-detail-page and all-questions-of-someone-page,also can be found in firefox/chrome.
There's something strange about the very beginning of the latter document; some strange character before the <!DOCTYPE HTML> tag.  I've pasted it in here, not sure if will show up, but in a hex editor it is efbb bf, whatever that is.

Edit: it's a special unicode character: U+FEFF ZERO WIDTH NO-BREAK SPACE, seems to break the code - Firefox warns in the source code viewer.
Nice suggestion! I open qa-uact-lang.php by notepad++,and change it from "UTF-8" to "UTF-8 without BOM". Then it's ok.
Thanks very very much~~~

3 Answers

0 votes

Ok, I have found on my installation it conflicts with q2a-badges.

When installed I get the following appear under the badges title on the user page :

Notice: Undefined index: value in /var/www/qa-include/qa-app-format.php(1264) : eval()'d code on line 42

If I delete the plugin, it dissappears, so there is something between the two conflicting.

Looks good tho :) great effort!

Ah, I found the problem in my plugin, it was picking up 0 as equal to the string 'questions'. Can you try grabbing the updated version from Github?
Or just change lines 39 and 44 of qa-user-activity-layer.php to use 3 equals signs instead of 2, i.e. === instead of ==
That seems to have fixed the issue :) Nice one thanks, really appreciate your work.
Want another bug report? lol Should I put forward issues on Github rather than here? Just holler over which you prefer.

Normally when I view a question around the site, since I have already voted on it, the up and down arrows to vote are disabled. But when visiting for example :


It seems to be activated, saying 'click to vote up' or down (clicking does nothing off course).
Thanks, I'll look into it. And you can submit future issues on Github, that way I can keep track and tick them off when fixed, thanks :)
0 votes

After checking "Log events to qa_eventlog database table" and clicking "Save" the page is blank and URL is not changing.

I checked my server error logs:

[11-May-2012 09:57:48] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required '/webseiten/gute-mathe-fragen/qa-include/qa-install.php' (include_path='.:/usr/local/lib/php') in /webseiten/gute-mathe-fragen/qa-include/qa-index.php on line 146

So the qa-install.php was missing.

Copying it to the server fixes the problem.

-> Cannot remember to have deleted this file. Can somebody confirm that it has to be there even after installation of q2a core?

got it, sorry. When installing q2a couple of months ago, I followed the "advanced" section for security:

"Remove the qa-install.php file inside the qa-include directory of your Question2Answer installation."

0 votes

I find a XSS related to this plugin

Like this url:

click here

Maybe we need to fix it.

Thanks for letting me know. Turns out the qa_lang_html() function doesn't escape the input like qa_html() does. Now fixed in the repo. It also shows a 404 if the user doesn't exist as a secondary measure.