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

New free plugin: Popular Questions Widget

+8 votes
1,026 views
asked Feb 17, 2016 in Plugins by q2apro
edited Feb 21, 2016 by q2apro

Description

This is a plugin for Question2Answer that displays the most viewed questions in a widget. The widget will be cached every x hours, this saves a lot of queries and mysql load.

Installation

  1. Install Question2Answer if you haven't already.
  2. Get the source code for this plugin directly from github or from the q2apro plugin page.
  3. Extract the files.
  4. Optional: Copy q2apro-popular-questions-lang-default.php to a new file and add your language, e.g. q2apro-popular-questions-lang-fr.php
  5. Upload the files to a subfolder called q2apro-popular-questions-widget inside the qa-plugin folder of your Q2A installation.
  6. Navigate to your site, go to Admin -> Plugins. Check if the plugin "q2apro Popular questions widget" is listed.
  7. Navigate to yourq2asite.com/admin/layout/ and add the widget to your layout.
  8. Congratulations, the widget will show up on the pages you selected.

Disclaimer

This is beta code. It is probably okay for production environments, but may not work exactly as expected. You bear the risk. Refunds will not be given!

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Copyright

All code herein is OpenSource. Feel free to build upon it and share with the world.

About q2a

Question2Answer is a free and open source PHP software for Q&A sites.

Final Note

If you use the plugin:

  • Consider joining the Question2Answer forum, answer some questions or write your own plugin!
  • You can use the code of this plugin to learn more about q2a-plugins. It is commented code.
  • Visit q2apro.com to get more free and premium plugins.

-----

Update to v0.2:

Instead of daily the cache update takes place hourly, see new admin option.

Also new: Admin can decide if the answer count is shown or not:

Q2A version: 1.7
commented Feb 17, 2016 by Gurjyot Singh
nice work... (Y)
commented Feb 19, 2016 by q2apro
edited Feb 20, 2016 by q2apro
I just realize that it could be that question title gets edited and changes. The cached data would still show the older question title. Maybe a minor issue, but an issue that could be solved by an event listener for the q_edit event.

Plus, the answer count would also need to be updated on answer events. But I prefer to not display the answer count (or give it an admin option to show the cached answer count).

I also think of a not daily update but maybe hourly or x hourly (admin option) for the cache, that would make the data more accurate.
commented Feb 21, 2016 by q2apro
I have updated the plugin as described above in the question.

Please log in or register to answer this question.

...