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

Hi all, the Q2A 1.7 beta should finally be released very soon! Myself or Gideon will make a post about that later but I wanted to post a few notes for plugin and theme development.

File structure

Firstly, I just made a major change to the structure of the qa-include folder. Most of the files now live in subfolders, for example qa-include/qa-app-format.php is now qa-include/app/format.php. For backwards compatibility, the old files have been kept as "stubs" which just 'require_once' the new files, but all developers should update their paths as they will be removed in a future version (probably 1.9).

For example where you used

require_once QA_INCLUDE_DIR . 'qa-app-format.php';

Replace with

require_once QA_INCLUDE_DIR . 'app/format.php';

For reference:

  • qa-ajax-* files are in ajax/
  • qa-app-* files are in app/
  • qa-db-* files are in db/
  • qa-lang-* files are in lang/ (not renamed)
  • qa-page-* & qa-page-admin-* files are in page/ & page/admin/
  • qa-util-* files are in util/
  • Plugin files are in plugins/
  • Third party code (htmlawed and phpmailer) is in vendor/


There is a new option for themes, '$ranking_block_layout' which shows ranking pages (Users/Tags) in blocks (similar to Stack Overflow) instead of a table. The Snow/Classic/Candy themes now have this, but the new SnowFlat theme does not yet. You can set this in your theme class with

protected $ranking_block_layout = true;

Both layouts use the same classes so it shouldn't be too big a task to update the CSS for the new layout. Look in the Snow or Classic theme CSS for examples.

Also, there a new option in the admin area to specify text direction (i.e. left-to-right or right-to-left). If you're developing a theme that supports both you can now use this to determine which stylesheet(s) to show. The $qa_content stores the direction 'ltr' or 'rtl' and can be accessed in themes using $this->content['direction']. The base theme also sets a boolean variable 'isRTL' so you can easily check in your theme by using for example

if ($this->isRTL) { ... }


As usual there are several new language keys. These will be listed in the upgrade notes but you can also just use the language checker in Admin>General.

Based on suggestions from pupi1985 we are also moving towards a new and easier system for metadata. Language metadata can be stored in a `metadata.php` file instead of a comment (see qa-lang/en-GB for an example). Currently this only supports `display_name` as the language name, but will be improved and expanded to themes and plugins in the future. This has been replaced by metadata.json, see the new thread.


There is one notable change to the init_queries function in plugins - the table names are no longer passed in lowercase. There was an issue when using an uppercase table prefix (e.g. QA_ instead of qa_) - the table names would be lowercase but the function to add prefixes would add the uppercase one.

This change may potentially break a plugin in one situation: when a developer has manually called strtolower on the table they are checking against. In other words this:

$tablename = strtolower(qa_db_add_table_prefix('mytable'));
if (!in_array($tablename, $tableslc)) { ... }

I have checked dozens of plugins and not found a single one for which this change will be a problem (and in fact it fixes the original issue for all those plugins).

Github development

I should also note here that from now on there is a small change to the Github workflow. I've created a new branch "1.8" which is for the next major version of Q2A. All new features and major changes will go here. The dev branch will serve as a "hotfix" branch for the current stable version.

In other words, anything for a 1.7.1 release would be on dev (then merged into master for release), with major changes on the 1.8 branch. When version 1.8 is released that will be merged into dev/master and a new 1.9 branch created. 1.8.1 would be on dev with major changes on 1.9.

Note, as well as new features, "major changes" include:

  • New language keys
  • Databse upgrades
  • Changes to the minimum PHP/MySQL requirements
  • Any other potentially backwards compatible change
Q2A version: 1.7-beta
Thanks for the info . :) .
There is something unclear to me in this comment "anything for a 1.7.1 release would be on dev". If what we have now is 1.7beta-1 and the dev branch will have all 1.7.1 stuff then what will 1.7.0 (release version) have? As I see it, the dev branch will have 1.7.x commits so it is actually a 1.7 branch which, in time, will evolve to 1.7.1. Is this correct?
Yes I mean that 'dev' would be for 1.7.x. In other words if there are bugs discovered after the beta being released, they will be fixed on the dev branch and that will become 1.7.0. Once 1.7.0 is released any bugs discovered and fixed would be on the dev branch for a 1.7.1 release. And so on.

In essence, the only difference to now is that major changes will be on the 1.8 branch. Hope that makes sense!
Crystal clear to me. By the way, here are some more bugfixes and minor improvements to add to the changelog to make it more representative. And I'm pretty sure there are plenty more!

 * Prevented users from favoriting themselves  
 * Corrected user count pages
 * Users can no longer favorite themselves
 * Null title and content are no longer allowed in posts
 * Corrected wrong sorting of the activity list

Minor improvements:
 * Improved the way URLs are automatically detected in posts
 * Notify of errors when uploading files by checking the servers' maximum allowed size

2 Answers

+1 vote
edited by

I salute your efforts.

File structure:

Is there any benefit by this change? Plugins that are maintained even now will be changed for V1.7. However, many plugins that have not been maintained as plugins of NoahY will lost compatibility. As a result, we will not be able to use very many plugins.




I could not understand well.


Since compatibility between OS may be broken by this change, WordPress and Drupal are limited to lowercase. Therefore, I will oppose.

Github development:

  1. Where V1.6.3 (stable version) exists in the github?
  2. Will be V1.6.3 maintained? (Will be V1.6.4 released?)


Users of Q2A has requested a lot of features for V1.7 in the thread below. What features have (will) been added in V1.7?


Thank you sama55, I was going to ask that question too... features implemented?
Hey sama. I hope to have answered your question about the language files in this post: http://www.question2answer.org/qa/40745/translating-files-in-q2a-v1-7
Thanks pupi. I could understand well. It is good solution.
File structure: Having over 150 files in one directory makes it difficult to work with. All plugins developed for 1.6 work fine in 1.7. If a plugin is updated to use the new 1.7 file paths, it will no longer work in 1.6, but the plugin author can set the minimum Q2A version. I'm not expecting everyone to change their plugins right away, you can wait until 1.8.

Plugins: as stated above, this change FIXES those plugins.

Other: The new features are listed here: http://www.question2answer.org/versions.php
There are not as many as I'd like, due to various circumstances I didn't manage to get as much done. But don't underestimate how much has changed, just look at the commit history on Github, there have been many improvements to the codebase. More features will be coming in 1.8.
Thank you Scott, I hope we will see most of the suggestions being implemented later... Thanks again...
@Scott: Sorry, my English is no good.
"this change FIXES those plugins" <== What does this mean?
Did you roll back the change of init_query? If so, it is good.
+1 vote
Kudos on great work. I suggest that after last 1.7 changes are pulled(or maybe they already are?) give developers a few days to update their plugins and themes before announcing new version's release.