Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
3.4k 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
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
edited by
Does the error appear in the table where you also have Questions, Answers, Comments totals? Can you post a screenshot of the error? It's possible that Noah's plugin adds to that data but does not use a "value" attribute. I'll check into it.
by
by
OK thanks. Looks like I need to find another way to hook into that table. I took a look at Noah's code on Github and can't see where this may be occurring. Do you have the latest version of the badges plugin?
by
Yes, I have only installed over the past 24hrs, and just deleted and downloaded from github again just in case.
by
Here is my list of installed plugins, just in case it is something else contributing.
Installed plugins:
Activity Count Widget 1.0 by Question2Answer
Ask Box Widget 1.0 by Question2Answer
Basic AdSense 1.0 by Question2Answer
Event Logger 1.0 by Question2Answer
Example Page 1.0 by Question2Answer
Facebook Login 1.0.1 by Question2Answer
Mouseover Layer 1.0 by Question2Answer
Badges 1.0b2 by NoahY
Ajax Comment Form 0.4 by NoahY
Embed YouTube 0.2 by NoahY
Share 0.1 by NoahY
User Activity Plus 1.0 by Scott Vivian
Tag Cloud Widget 1.0 by Question2Answer
WYSIWYG Editor 1.1 by Question2Answer
XML Sitemap 1.0 by Question2Answer
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.
...