Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
4.3k views
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.)

Updates:

  • 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.

by
Thats great! Thanks for this plugin. Where can I see the demo of this plugin?
by
I updata this code:
$sel_count = $row['selected'] === NULL ? 0 : $row['selected'];
instead of:
$sel_count = $row['selected'];
in qa-user-activity.php
by
I added the plugin, then the page of "All questions of someone" seems error(in IE).
This code: "meta http-equiv=Content-type content=text/html; charset=utf-8 " become part of "body" . Like this,some code should be in "head",but now they are in "body". It makes my website confused. Is it a bug?
by
Do you have a link to an example page where the issue occurs?
by
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:
http://2.weiboqa.sinaapp.com/index.php?qa=ask

This bug also can be found in question-detail-page and all-questions-of-someone-page,also can be found in firefox/chrome.
by
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.
by
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
by

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!

by
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 ==
by
That seems to have fixed the issue :) Nice one thanks, really appreciate your work.
by
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 :

/user-activity/questions/Davo

It seems to be activated, saying 'click to vote up' or down (clicking does nothing off course).
by
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
by

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?

by
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."

http://www.question2answer.org/secure.php
0 votes
by

I find a XSS related to this plugin

Like this url:

click here

Maybe we need to fix it.

by
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.
...