Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Q2A Core by
Normally, Name and Email is optional on Send Feedback Page.

But I want to do necessary and not null.

How can I do it?
Q2A version: 1.7.4

1 Answer

+1 vote

I hacked feedback form with this specification. My hacks are below.


else {
    if (empty($inmessage))
    // Add [Start]
    if (empty($inname))
    if (empty($inemail))
    // Add [end]

    // Add [Start]
    if(isset($userprofile['name']) && !empty($userprofile['name']))
        $name = $userprofile['name'];
        $name = @$useraccount['handle'];
    // Add [End]

    'type' => $feedbacksent ? 'static' : '',
    'label' => qa_lang_html('misc/feedback_name'),
    'tags' => 'name="name"',
    // Replace [Start]
    //'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']),
    'value' => qa_html(isset($inname) ? $inname : $name),
    'error' => qa_html(@$errors['name']),
    // Replace [End]

    'tags' => 'name="email"',
    'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()),
    'note' => $feedbacksent ? null : qa_opt('email_privacy'),
    // Add [Start]
    'error' => qa_html(@$errors['email']),
    // Add [End]


// Replace [Start]
//'feedback_email' => 'Your email: (optional)',
//'feedback_empty' => 'Please use this field to send some comments or suggestions',
//'feedback_message' => 'Your comments or suggestions for ^:',
//'feedback_name' => 'Your name: (optional)',
'feedback_email' => 'Your email:',
'feedback_empty' => 'Please use this field to send message',
'feedback_message' => 'Your message for ^:',
'feedback_name' => 'Your name:',
// Replace [End]


qa-lang/custom/qa-lang-misc.php <= Create new custom language file

return array(
'feedback_email' => 'Your email:',
'feedback_empty' => 'Please use this field to send message',
'feedback_message' => 'Your message for ^:',
'feedback_name' => 'Your name:',

And also, you can deal with creating AND replacing with your new feedback form. In this case, you need experience of creating plugins.

  • Create new your page plugin
  • Copy program from qa-include/pages/feedback.php to your page in page plugin.
  • Modify according to the above procedure

Thank you very much and powerqa's theme is very nice.

Can I find anywhere this theme? :D
Seems codings have been changed for v1.7.5