title: Magento newsletter auto checked on registration Page
body: <p>I'm running magento 1.7.0.2 and I want the checkbox of the newsletter subscription on the registration page checked by default. I have followed a few hacks but they were all written for older versions of magento.
  Here's a link to one of the hacks which I tried and didn't work: <a href="https://stackoverflow.com/questions/3447922/force-newsletter-subscription-in-magento">Force newsletter subscription in Magento</a></p>
  
  <p>Any help is greatly appreciated!</p>
  
  <pre><code>&lt;div class="account-create"&gt;
  &lt;div class="page-title"&gt;
      &lt;h1&gt;&lt;?php echo $this-&gt;__('Complete your profile') ?&gt;&lt;/h1&gt;
  &lt;/div&gt;
  &lt;?php echo $this-&gt;getChildHtml('form_fields_before')?&gt;
  &lt;?php echo $this-&gt;getMessagesBlock()-&gt;getGroupedHtml() ?&gt;
  &lt;?php /* Extensions placeholder */ ?&gt;
  &lt;?php echo $this-&gt;getChildHtml('customer.form.register.extra')?&gt;
  &lt;form action="&lt;?php echo $this-&gt;getPostActionUrl() ?&gt;" method="post" id="form-validate"&gt;
      &lt;div class="fieldset"&gt;
          &lt;input type="hidden" name="success_url" value="&lt;?php echo $this-&gt;getSuccessUrl() ?&gt;" /&gt;
          &lt;input type="hidden" name="error_url" value="&lt;?php echo $this-&gt;getErrorUrl() ?&gt;" /&gt;
          &lt;input type="hidden" name="success_url" value="&lt;?php echo $this-&gt;getSuccessUrl() ?&gt;" /&gt;
          &lt;h2 class="legend"&gt;&lt;?php echo $this-&gt;__('Personal Information') ?&gt;&lt;/h2&gt;
          &lt;ul class="form-list"&gt;
              &lt;li class="fields"&gt;
                  &lt;?php echo $this-&gt;getLayout()-&gt;createBlock('customer/widget_name')-&gt;setObject($this-&gt;getFormData())-&gt;setForceUseCustomerAttributes(true)-&gt;toHtml() ?&gt;
              &lt;/li&gt;
              &lt;li&gt;
                  &lt;label for="email_address" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Email Address') ?&gt;&lt;/label&gt;
                  &lt;div class="input-box"&gt;
                      &lt;input type="text" name="email" id="email_address" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getEmail()) ?&gt;" title="&lt;?php echo $this-&gt;__('Email Address') ?&gt;" class="input-text validate-email required-entry" /&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
              &lt;?php if ($this-&gt;isNewsletterEnabled()): ?&gt;
              &lt;li class="control"&gt;
                  &lt;div class="input-box"&gt;
                       &lt;li&gt;
       &lt;input type="checkbox" name="is_subscribed" title="&lt;?php echo $this-&gt;__('Sign Up for Newsletter') ?&gt;" value="1" id="is_subscribed" &lt;?php if($this-&gt;getFormData()-&gt;getIsSubscribed()){ ?&gt; checked="checked"&lt;?php }elseif($this-&gt;getFormData()-&gt;getIsSubscribed == NULL){ ?&gt; checked="checked"&lt;?php }?&gt; /&gt;
      &lt;label for="is_subscribed"&gt;&lt;?php echo $this-&gt;__('Sign Up for Newsletter') ?&gt;&lt;/label&gt;
  &lt;/li&gt;
                  &lt;/div&gt;
                  &lt;label for="is_subscribed"&gt;&lt;?php echo $this-&gt;__('Sign Up for Newsletter') ?&gt;&lt;/label&gt;
                  &lt;?php /* Extensions placeholder */ ?&gt;
                  &lt;?php echo $this-&gt;getChildHtml('customer.form.register.newsletter')?&gt;
              &lt;/li&gt;
              &lt;?php endif ?&gt;
          &lt;?php $_dob = $this-&gt;getLayout()-&gt;createBlock('customer/widget_dob') ?&gt;
          &lt;?php if ($_dob-&gt;isEnabled()): ?&gt;
              &lt;li&gt;&lt;?php echo $_dob-&gt;setDate($this-&gt;getFormData()-&gt;getDob())-&gt;toHtml() ?&gt;&lt;/li&gt;
          &lt;?php endif ?&gt;
          &lt;?php $_taxvat = $this-&gt;getLayout()-&gt;createBlock('customer/widget_taxvat') ?&gt;
          &lt;?php if ($_taxvat-&gt;isEnabled()): ?&gt;
              &lt;li&gt;&lt;?php echo $_taxvat-&gt;setTaxvat($this-&gt;getFormData()-&gt;getTaxvat())-&gt;toHtml() ?&gt;&lt;/li&gt;
          &lt;?php endif ?&gt;
          &lt;?php $_gender = $this-&gt;getLayout()-&gt;createBlock('customer/widget_gender') ?&gt;
          &lt;?php if ($_gender-&gt;isEnabled()): ?&gt;
              &lt;li&gt;&lt;?php echo $_gender-&gt;setGender($this-&gt;getFormData()-&gt;getGender())-&gt;toHtml() ?&gt;&lt;/li&gt;
          &lt;?php endif ?&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;?php if($this-&gt;getShowAddressFields()): ?&gt;
      &lt;div class="fieldset"&gt;
          &lt;input type="hidden" name="create_address" value="1" /&gt;
          &lt;h2 class="legend"&gt;&lt;?php echo $this-&gt;__('Address Information') ?&gt;&lt;/h2&gt;
          &lt;ul class="form-list"&gt;
              &lt;li class="fields"&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="company"&gt;&lt;?php echo $this-&gt;__('Company') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="text" name="company" id="company" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getCompany()) ?&gt;" title="&lt;?php echo $this-&gt;__('Company') ?&gt;" class="input-text &lt;?php echo $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('company') ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="telephone" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Telephone') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="text" name="telephone" id="telephone" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getTelephone()) ?&gt;" title="&lt;?php echo $this-&gt;__('Telephone') ?&gt;" class="input-text &lt;?php echo $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('telephone') ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;?php $_streetValidationClass = $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('street'); ?&gt;
              &lt;li class="wide"&gt;
                  &lt;label for="street_1" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Street Address') ?&gt;&lt;/label&gt;
                  &lt;div class="input-box"&gt;
                      &lt;input type="text" name="street[]" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getStreet(1)) ?&gt;" title="&lt;?php echo $this-&gt;__('Street Address') ?&gt;" id="street_1" class="input-text &lt;?php echo $_streetValidationClass ?&gt;" /&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?&gt;
          &lt;?php for ($_i = 2, $_n = $this-&gt;helper('customer/address')-&gt;getStreetLines(); $_i &lt;= $_n; $_i++): ?&gt;
              &lt;li class="wide"&gt;
                  &lt;div class="input-box"&gt;
                      &lt;input type="text" name="street[]" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getStreet($_i)) ?&gt;" title="&lt;?php echo $this-&gt;__('Street Address %s', $_i) ?&gt;" id="street_&lt;?php echo $_i ?&gt;" class="input-text &lt;?php echo $_streetValidationClass ?&gt;" /&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;?php endfor; ?&gt;
              &lt;li class="fields"&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="city" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('City') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="text" name="city" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getCity()) ?&gt;" title="&lt;?php echo $this-&gt;__('City') ?&gt;" class="input-text &lt;?php echo $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('city') ?&gt;" id="city" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="region_id" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('State/Province') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;select id="region_id" name="region_id" title="&lt;?php echo $this-&gt;__('State/Province') ?&gt;" class="validate-select" style="display:none;"&gt;
                              &lt;option value=""&gt;&lt;?php echo $this-&gt;__('Please select region, state or province') ?&gt;&lt;/option&gt;
                          &lt;/select&gt;
                          &lt;script type="text/javascript"&gt;
                          //&lt;![CDATA[
                              $('region_id').setAttribute('defaultValue', "&lt;?php echo $this-&gt;getFormData()-&gt;getRegionId() ?&gt;");
                          //]]&gt;
                          &lt;/script&gt;
                          &lt;input type="text" id="region" name="region" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getRegion()) ?&gt;" title="&lt;?php echo $this-&gt;__('State/Province') ?&gt;" class="input-text &lt;?php echo $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('region') ?&gt;" style="display:none;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
              &lt;li class="fields"&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="zip" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Zip/Postal Code') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="text" name="postcode" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getFormData()-&gt;getPostcode()) ?&gt;" title="&lt;?php echo $this-&gt;__('Zip/Postal Code') ?&gt;" id="zip" class="input-text validate-zip-international &lt;?php echo $this-&gt;helper('customer/address')-&gt;getAttributeValidationClass('postcode') ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="country" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Country') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;?php echo $this-&gt;getCountryHtmlSelect() ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
          &lt;input type="hidden" name="default_billing" value="1" /&gt;
          &lt;input type="hidden" name="default_shipping" value="1" /&gt;
      &lt;/div&gt;
  &lt;?php endif; ?&gt;
      &lt;div class="fieldset"&gt;
          &lt;h2 class="legend"&gt;&lt;?php echo $this-&gt;__('Login Information') ?&gt;&lt;/h2&gt;
          &lt;ul class="form-list"&gt;
              &lt;li class="fields"&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="password" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Password') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="password" name="password" id="password" title="&lt;?php echo $this-&gt;__('Password') ?&gt;" class="input-text required-entry validate-password" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="field"&gt;
                      &lt;label for="confirmation" class="required"&gt;&lt;em&gt;*&lt;/em&gt;&lt;?php echo $this-&gt;__('Confirm Password') ?&gt;&lt;/label&gt;
                      &lt;div class="input-box"&gt;
                          &lt;input type="password" name="confirmation" title="&lt;?php echo $this-&gt;__('Confirm Password') ?&gt;" id="confirmation" class="input-text required-entry validate-cpassword" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
              &lt;?php echo $this-&gt;getChildHtml('form.additional.info'); ?&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="buttons-set"&gt;
          &lt;p class="required"&gt;&lt;?php echo $this-&gt;__('* Required Fields') ?&gt;&lt;/p&gt;
          &lt;p class="back-link"&gt;&lt;a href="&lt;?php echo $this-&gt;escapeUrl($this-&gt;getBackUrl()) ?&gt;" class="back-link"&gt;&lt;small&gt;&amp;laquo; &lt;/small&gt;&lt;?php echo $this-&gt;__('Back') ?&gt;&lt;/a&gt;&lt;/p&gt;
          &lt;button type="submit" title="&lt;?php echo $this-&gt;__('Submit') ?&gt;" class="button"&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Submit') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
      var dataForm = new VarienForm('form-validate', true);
      &lt;?php if($this-&gt;getShowAddressFields()): ?&gt;
      new RegionUpdater('country', 'region', 'region_id', &lt;?php echo $this-&gt;helper('directory')-&gt;getRegionJson() ?&gt;, undefined, 'zip');
      &lt;?php endif; ?&gt;
  //]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p></p>