Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
827 views
in Q2A Core by

Firstofall, thanks for the great help you provide here !

I have been searching for ages how to hide "email me chekbox" in comment and answer ?

I follow instructions here => http://www.question2answer.org/qa/29745/how-to-hide-email-me-checkbox

but I manage only to delete in when someone ask question.

I deleted : qa_set_up_notify_fields($qa_content, $qa_content['form']['fields'], 'Q', qa_get_logged_in_email(),
        isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], @$errors['email']);

from qa-page-question-post.php with no result.

Please help !

3 Answers

+1 vote
by
selected by
 
Best answer

My advice. You may be able to cope your hope by adding lower code to your theme.

function main_parts($content) {
  $email = qa_get_logged_in_email();
  if($this->template == 'ask') {
    if(isset($content['form']['fields']['notify'])) {
      if(!is_null($email))
        $notifyvalue = $content['form']['fields']['notify']['value'];
      else
        $notifyvalue = 0;
      $content['form']['hidden']['notify'] = $notifyvalue;
      unset($content['form']['fields']['notify']);
    }
  }
  if($this->template == 'question') {
    if(isset($content['q_view']['c_form']['fields']['notify'])) {
      if(!is_null($email))
        $notifyvalue = $content['q_view']['c_form']['fields']['notify']['value'];
      else
        $notifyvalue = 0;
      $content['q_view']['c_form']['hidden']['notify'] = $notifyvalue;
      unset($content['q_view']['c_form']['fields']['notify']);
    }
    if(isset($content['a_form']['fields']['notify'])) {
      $content['a_form']['hidden']['notify'] = $content['a_form']['fields']['notify']['value'];
      unset($content['a_form']['fields']['notify']);
    }
    if(isset($content['a_list']['as'])) {
      foreach($content['a_list']['as'] as $key => $answer) {
        if(isset($content['a_list']['as'][$key]['c_form']['fields']['notify'])) {
          if(!is_null($email))
            $notifyvalue = $content['a_list']['as'][$key]['c_form']['fields']['notify']['value'];
          else
            $notifyvalue = 0;
          $content['a_list']['as'][$key]['c_form']['hidden']['c'.$answer['raw']['postid'].'_notify'] = $notifyvalue;
          unset($content['a_list']['as'][$key]['c_form']['fields']['notify']);
        }
      }
    }
  }
  qa_html_theme_base::main_parts($content);
}
Restriction: Notice feature of the anonymous users becomes disable.
by
Hello Sama55,
I tried what you said, and I paste this on my theme, but nothing happened.

Any other suggestion ?
by
It is necessary to confirm it at logged in status. In addition, it works definitely in my environment (Q2A-V1.6.2). It may be caused by some kind of differences with your environment. It is necessary that you add debugging code after each "if(...)". e.g...

echo 'Program was executed here.';
by
yes ! I tried again and its seem to work perfectly, thanks !
0 votes
by

if this is the only checkbox on the page you can use jquery:

$('.qa-form-tall-checkbox').parent().hide();

 

otherwise check the qa-app-format.php file for:
qa_lang_html('question/a_notify_label')
qa_lang_html('question/c_notify_label')

by
Hi Kai Echteinfachtv,

I deleted 2 lines (just under qa_lang_html('question/a_notify_label') =>
    $labelgotemail=qa_lang_html('question/a_notify_x_label');
    $labelgotemail=qa_lang_html('question/c_notify_x_label');

But, I got an error and even the text disapear, the box was still there...
Notice: Undefined variable: labelgotemail in /home/numeroco/public_html/odlg.org/qa-include/qa-app-format.php on line 1609

And couldnt find where to add : $('.qa-form-tall-checkbox').parent().hide();

Any idea ?
by
comment out everything from:

if (empty($login_email)) {
...
to
        } else {
            $fields['notify']['label']=str_replace('^', qa_html($login_email), $labelgotemail);
    }

I have not tested it, it could be that q2a is asking for email or so. just try it :)


The $('.qa-form-tall-checkbox').parent().hide(); you can add to ask.js for example, like that:

$(document).ready(function(){
  $('.qa-form-tall-checkbox').parent().hide();
});
by
edited by
I tried to comment out everything but i got this :
Parse error: syntax error, unexpected $end in /home/numeroco/public_html/odlg.org/qa-include/qa-app-format.php on line 1944

It did works by adding :
$(document).ready(function(){
  $('.qa-form-tall-checkbox').parent().hide();
});

in qa-page.js , but It make issues with the admin pannel.
0 votes
by
Actually it's not working become on the admin pannel they are chekbox like "take site down in maintenance" and when I add code in javascript page, it make issues with that;

Any other idea ?!
by
$(document).ready(function(){
  $('.qa-template-ask .qa-form-tall-checkbox').parent().hide();
});
...