MyBB Community Forums

Full Version: Make registration form's checkboxes already checked
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As I said in the title, I want some of the checkboxes of the registration form to be already checked.

This is the piece of code from the member_register template I need to change:
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="allownotices" id="allownotices" value="1" {$allownoticescheck} /></td>
<td valign="top"><span class="smalltext"><label for="allownotices">{$lang->allow_notices}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="hideemail" id="hideemail" value="1" {$hideemailcheck} /></td>
<td valign="top"><span class="smalltext"><label for="hideemail">{$lang->hide_email}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="receivepms" id="receivepms" value="1" {$receivepmscheck} /></td>
<td valign="top"><span class="smalltext"><label for="receivepms">{$lang->receive_pms}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="pmnotice" id="pmnotice" value="1"{$pmnoticecheck} /></td>
<td valign="top"><span class="smalltext"><label for="pmnotice">{$lang->pm_notice}</label></span></td>
What I need is for the "hide mail" checkbox to be already checked. I know that the value "1" means "checked", and "0" means "not checked", but even though hide email value's is on "1", that's the only voice which is not already checked. The other 3 are checked except for "hide email". How come?
checked="checked" needs to be used instead of the checking variable like below
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="allownotices" id="allownotices" value="1" checked="checked" /></td>
(2016-05-11, 02:50 PM).m. Wrote: [ -> ]checked="checked" needs to be used instead of the checking variable like below
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="allownotices" id="allownotices" value="1" checked="checked" /></td>

Fantastic! Big Grin Thanks!