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

Update Plugin: Extra Question Field (V1.7)

+22 votes
asked Apr 22, 2013 in Plugins by sama55
edited Feb 4, 2015 by sama55

This plugin add extra fields to ask / edit form and question page. Although Q2A can add only one textbox, this plugin can add textbox / checkbox / selectionbox / radiobutton / textarea / file without any restriction. Refer to readme in download-file for description.


  1. Screen shot 1: ask form
  2. Screen shot 2: page view (no design by CSS)
  3. Screen shot 3: edit form


Q2A V1.6, V1.7 [2014/12/30 Updated]

Update history

  • [V1.7] 2015/02/04 Add file extension check feature in case of file type field.
  • [V1.6.4] 2014/09/19  Fixed bug (If files exist on upper content, popup don't work)
  • [V1.6.3] 2014/03/16  Fixed bug (Error on none description question post)
  • [V1.6.2] 2014/03/13  Fixed bug (Post data of none moderated user is not stored on moderation mode)
  • [V1.6.1] 2014/01/09  Fixed bug when question is hided.
  • [V1.6] 2013/12/13  Add lightbox effect with responsive design.
  • [V1.5] 2013/12/05  Add textarea and file type. And, Fixed a lot of bugs.
  • [V1.4] Add required option.


Have hun !!

Q2A version: 1.6, 1.7
commented Sep 13, 2015 by WhyCheese
Download link is broken
commented Sep 15, 2015 by Rob Mansfield
Sama - As others have said the link is broken.
commented Sep 22, 2015 by Raees Rahim
All the download links for your plugins are broken.
I hope this can be fixed.
commented Sep 30, 2017 by donshakespeare
Anybody know where we can find the code to this plugin?

8 Answers

+3 votes
answered Apr 22, 2013 by VdoubleE
Nice plugin but one thing! Is there a way to hide the label on question page if there is no input?
commented Apr 22, 2013 by sama55
Thank you VdoubleE for your opinion. I try improvement.
commented Apr 23, 2013 by VdoubleE
Perfect! This plugin is so needed thanks for listening!
+1 vote
answered Apr 23, 2013 by monk333
Really excellent work !!

I just hope that we will have one day as well an image-field or gallery-field so we can use q2a in so many other ways.

Classifieds for example...

Thank You !!
commented Apr 23, 2013 by sama55
Thank you monk333 for your opinion. Like forum-CMS(Bulletin board etc), it is good that  files can be attached "easily" by extra field. I feel that Jatin was developed plugin which attaches voice file too. I will further develop.
+1 vote
answered Oct 5, 2013 by karo
Hi sama55,
This is great!
I am looking for a way to add titles to answers and it seems that adding your text field would do the trick. Is there an easy way to also apply this feature on answers?
Would most appreciate your elaborate answer (as much as you can)
Thanks in advance.
commented Oct 6, 2013 by sama55
Thanks karo. qa_postmetas table key is postid. Therefor, I think that you can add extra fields to answer, if you make other plugin mimicking my plugin.
commented Oct 7, 2013 by karo
Yeah that's the idea,
I`m new to Q2A and still trying to figure out where are the relevant values for answer form and question form and replace the two.
Would most appreciate your help on this
+1 vote
answered Apr 24, 2014 by Gurjyot Singh
I have one question for this plugin, that should we have to set a particular value of attachment fields or with every attachment a next attachment file option will come forward?
+1 vote
answered Jun 9, 2014 by brinch
Hi Sama
In your filter file, you have a process_event function where you declare a global $qa_extra_question_fields. You then test if it's set.
My questions are:
1) Will it ever be set?
2) Will it issue a warning if testing on a variable index not set?
function process_event ($event, $userid, $handle, $cookieid, $params) {
   global $qa_extra_question_fields;
   switch ($event) {
      case 'q_queue':
      case 'q_post':
      case 'q_edit':
         for($key=1; $key<=qa_eqf::FIELD_COUNT_MAX; $key++) {
            if((bool)qa_opt(qa_eqf::FIELD_ACTIVE.$key)) {
              $name = qa_eqf::FIELD_BASE_NAME.$key;
                 $content = qa_sanitize_html($qa_extra_question_fields[$name]['value']);
                 $content = qa_db_single_select(qa_db_post_meta_selectspec($params['postid'], 'qa_q_'.$name));
                 $content = '';
             qa_db_postmeta_set($params['postid'], 'qa_q_'.$name, $content);
    case 'q_delete':
        for($key=1; $key<=qa_eqf::FIELD_COUNT_MAX; $key++) {
            if((bool)qa_opt(qa_eqf::FIELD_ACTIVE.$key)) {
               $name = qa_eqf::FIELD_BASE_NAME.$key;
               qa_db_postmeta_clear($params['postid'], 'qa_q_'.$name);
commented Jun 13, 2014 by sama55
Since I do not watch your output HTML, I do not understand detailed things. Probably it will be a basic problem irrelevant to Q2A.

commented Jun 14, 2014 by brinch
Hmmm, can it be the difference in the way the forms are submitted? When I submit a question the page is reloaded, but when I submit an answer/comment the page is not reloaded (it's ajax right)? Could that be the reason the $_FILE is empty when the process_event (in the event file) is called for comments/answers?
commented Jun 14, 2014 by brinch
After further investigation, I don't think it's possible to do this file upload for answer/comment at all. Since answers/comments are not really submitted (but saved via ajax), there is no way the $_FILES is set.
commented Jun 16, 2014 by brinch
I think this will work, however it's not easy: In the form for answer/comment, add an iframe. The iframe contains an extra form with just an input of type FILE (style it so the user won't notice the iframe) for the user to select a file to upload. Action on the form in the iframe is set to our own php-file. This php will take care of saving the file to the database. When submit button is triggered on answer/comment form (catch in new plugin -> events), we programmatically trigger the iframe submit.

Some of this ugly workaround could have been avoided if Q2A was upgraded to HTML5. Then I could have used Ajax upload plugins. I don't understand why Q2A is still running HTML4.01 - it's not like HTML5 is cutting edge :-)
0 votes
answered Mar 23, 2015 by joreg
helo sama,

thanks for your work. i just tried to use EQF with q&a1.7 and don't seem to get it to work. i can configure the plugin in the admin section to show one file upload field, but it doesn't show up when asking a new question.

when enabling "Input is required" i get an error when trying to post a question, so it seems the plugin is active somehow only i don't see any field that i could input as a user.

is there anything i could be doing wrong?
commented Mar 24, 2015 by sama55
This is running correctly in my environment. If there is not more detailed information, it is difficult to advice. e.g. Error contents, your theme, other plugin, etc.
commented Mar 24, 2015 by joreg
ah, thanks for the hint: i removed all other plugins and found http://peatarian.com/blob/loginrequirement.zip as mentioned here: http://www.question2answer.org/qa/26289/how-can-i-hide-all-info-when-users-are-not-authenticated?show=26289#q26289 to be the culprit.

if i remove that plugin, yours works.
any idea how to fix that?

or an other idea to hide the questions page to unauthorized users?
commented Mar 24, 2015 by sama55
edited Mar 24, 2015 by sama55
Your code is wrong. If you call the below line in somewhere in your main function, my plugin will work correctly.
Or, your two changes should be processed at the first of the two functions.
page_title_error() and main_parts()

Coding method of correct layer function:
Point: If you want to ensure compatibility with other plugins, you will need to call the same named parent function. e.g.
qa_html_theme_base::nav_list($navigation, $navtype);
qa_html_theme_base::post_tag_list($post, $class);
qa_html_theme_base::post_meta_who($post, $class);
commented Mar 24, 2015 by joreg
i am afraid i didn't write that code myself and am not familiar with php...anyway i tried to follow your advice and put the line
in line 13 of qa-login-requirement-layer.php

looks like so:
    function main()

now your plugin indeed works, but this plugin is broken in that questions are now visible to unauthorized users. any more hints you could give me?
0 votes
answered Apr 23, 2015 by gold.developer

Hey @sama55 !

Great plugin! I was wondering and already asked here on Q2A, how can I use Markdown/CKEditor4 instead of using the simple normal default editor on the text area field?

0 votes
answered Oct 15, 2015 by fara
Thanks for the plugin!


How can I allow only registered users to upload files?