We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    Hello, I want to do something quite specific, which is to change the default of the subscribe checkboxs. I want the default on new threads to be checked, but on reply and modify I want the default as unchecked. There is one for the new post, one for the reply, and one for the modify post, and all are default to checked, I think that's all.

    Right now I want to change the default for the modify post view.

    I drilled down a bit and think I found the proper code here: core/components/discuss/controllers/web/thread/modify.class.php

           /* If the editing user is the author, show him the subscribe checkbox */
            if($this->discuss->user->get('id') == $this->post->get('author') 
                && ($this->thread->canSubscribe() || $this->thread->canUnsubscribe())) {
                $checked = !empty($_POST) ? !empty($_POST['notify']) : $this->thread->hasSubscription();
                $placeholders['notify']     = $checked ? ' checked="checked"' : '';
                $placeholders['notify_cb']  = $this->discuss->getChunk('form/disCheckbox',array(
                    'name' => 'notify',
                    'value' => 1,
                    'text' => $this->getOption('textCheckboxNotify'),
                    'attributes' => $placeholders['notify'],
                ));
                $placeholders['can_subscribe'] = true;
            }
    
            $this->getThreadSummary();
    
            /* output form to browser */...
    


    So all I have to do is change this line, am I right?

      $placeholders['notify_cb']  = $this->discuss->getChunk('form/disCheckbox',array(
                    'name' => 'notify',
                    'value' => 0,


    I am going to test it now.

    This question has been answered by nuan88. See the first response.

      • 46886
      • 1,154 Posts
      Huh, strangely on my install new thread and reply are both not default checked, but modify is. And this doesn't seem to work...will keep looking at this issue.

      Seems as there are 4, I notice that the default is on for threads I started, but not others.
        • 46886
        • 1,154 Posts
        Hmm I think this works. No checked box in modify post view now. If the subscription is already in place, it seems the box will appear as checked. And I wouldn't trust unchecking it to really end the subscription.

        Anyway right now it looks like it works. Now to get default checked on new threads. I figure people want to see replies to their new threads.
        • discuss.answer
          • 46886
          • 1,154 Posts
          Seems strange, the code for a new thread is different, and isn't defaulted to on, so i don't know what to do here. Also I found that maybe my changes did more than I wanted, it seems that box is now useless and can't set the subscription.

          From core/components/discuss/controllers/web/thread/new.class.php:

                 // show subscribe checkbox
                  $notify = !empty($_POST['notify']) ? ' checked="checked"' : '';
                  $this->setPlaceholders(array(
                      'notify_cb' => $this->discuss->getChunk('form/disCheckbox',array(
                          'name' => 'notify',
                          'value' => 1,
                          'text' => $this->getOption('textCheckboxNotify'),
                          'attributes' => $notify,
                      )),
                  ));
          
            • 46886
            • 1,154 Posts
            So this code isn't useful for this issue? It looked like, to my untrained eye, exactly where the default value would appear.