• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Activate Standard Silent Edit

Marcus

Well-known member
#1
How can I activate "Silent Edit" for all my edits? In template helper_edit_silent there are {xen:checked $silentEdit} and {xen:checked $clearEdit}, so I guess there must be a configuration to activate them by default.
 

Chris D

XenForo developer
Staff member
#2
Set the var where the template is called.

e.g. in post_edit_inline

change:

Code:
    <xen:if is="{$canSilentEdit}">
        <xen:include template="helper_edit_silent">
            <xen:set var="$extraClasses">secondaryContent</xen:set>
        </xen:include>
    </xen:if>
to:

Code:
    <xen:if is="{$canSilentEdit}">
        <xen:include template="helper_edit_silent">
            <xen:set var="$extraClasses">secondaryContent</xen:set>
            <xen:set var="$silentEdit">1</xen:set>
        </xen:include>
    </xen:if>
 

Marcus

Well-known member
#3
Thanks! Isn't there a user setting? I thought, if there is a variable, then there must be a place where the variable is defined. All I can see is this:

upload_2013-8-29_14-40-51.png
 

Chris D

XenForo developer
Staff member
#4
It's not a user setting.

If you look at the code:

PHP:
        if ($this->_input->inRequest('more_options'))
        {
            $viewParams['silentEdit'] = $this->_input->filterSingle('silent', XenForo_Input::UINT);
            $viewParams['clearEdit'] = $this->_input->filterSingle('clear_edit', XenForo_Input::UINT);
        }
The "more_options" key is supplied in the request if you're editing a post and you click the "More Options" button. If you have already checked these boxes in the Edit overlay, and you click the "More Options" button, then they will carry over to the main edit screen.

So, no. There is not a user setting.

But if you want to set a different default option then you would either need to write an add-on to set the $silentEdit and $clearEdit params from a user field setting or Admin CP option, or if it's for your own use, just set it during template include in the template like my example above.
 

Marcus

Well-known member
#5
Template helper_edit_silent

PHP:
<dl class="ctrlUnit {$extraClasses}">
   <dt></dt>
   <dd><ul>
     <li><label><input type="checkbox" name="silent" value="1" id="ctrl_silent" class="Disabler" {xen:checked $silentEdit} "/> {xen:phrase edit_silently}</label>
       <p class="explain">{xen:phrase if_selected_no_last_edited_note_will_be_added_for_this_edit}</p>
       <ul id="ctrl_silent_Disabler">
         <li><label><input type="checkbox" name="clear_edit" value="1" {xen:checked $clearEdit} /> {xen:phrase clear_last_edit_information}</label>
           <p class="explain">{xen:phrase if_selected_any_existing_last_edited_note_will_be_removed}</p>
         </li>
       </ul>
     </li>
   </ul></dd>
</dl>
I don't understand {xen:checked $clearEdit} and {xen:checked $silentEdit}
 

Chris D

XenForo developer
Staff member
#6
{xen:checked $silentEdit} is equivalent to saying:

if the $silentEdit parameter is set, this checkbox should be checked by default, e.g.:

Code:
<input type="checkbox" name="silent" value="1" id="ctrl_silent" class="Disabler" checked />
checked forces the checkbox to be in a checked state.

So my example above, sets the $silentEdit parameter to 1, thereby forcing the silent edit checkbox to be checked by default.
 

Marcus

Well-known member
#7
Thanks I understand. I thought if the developers check against a variable, this variable would be set anywhere in the system. But it looks more like a "hook" or "plugin" system :)