Not a bug activity_privacy_row macro bug

JoyFreak

Well-known member
Affected version
2.2.2
This one is strange.

I've removed "<xf:macro template="helper_account" name="activity_privacy_row" />" from template "account_preferences". When I go into my preferences and save my changes, it disables "Show your online status".
 
Usually, if checkbox inputs aren't present in the form, they will be interpreted the same as being unchecked. You might want to replace it with a hidden input instead. For example:

HTML:
<xf:hiddenval name="user[visible]" value="{$xf.visitor.visible}" />
<xf:hiddenval name="user[activity_visible]" value="{$xf.visitor.activity_visible}" />

Note that crafty users can still manipulate the input values in the inspector, so an add-on would be required to properly disable the processing of the inputs.
 
Last edited:
Usually, if checkbox inputs aren't present in the form, they will be interpreted the same as being unchecked. You might want to replace it with a hidden input instead. For example:

HTML:
<xf:hiddenval name="user[visible]" checked="{$xf.visitor.visible}" />
<xf:hiddenval name="user[activity_visible]" checked="{$xf.visitor.activity_visible}" />

Note that crafty users can still manipulate the input values in the inspector, so an add-on would be required to properly disable the processing of the inputs.
Am I replacing "<xf:macro template="helper_account" name="activity_privacy_row" />" with the above? Because, that did not work. It still unchecks the check box when saving.
 
How can I disable the processing of the inputs? I thought removing the macro would be sufficient?

I've removed in a few other places, like the DOB and Email options, limiting it to only one place. Just realised, it's messed it up as well.
 
If you're keeping them available somewhere then it should only be necessary to replace the inputs with hidden values, I thought you were trying to prevent users from changing them entirely. Generally you just want to copy the input name and value attributes from the input you're removing into a <xf:hiddenval .../> tag which replaces it.
 
Like above?

I tried that but it was too confusing. For example, if I wanted to remove "<xf:macro template="helper_account" name="email_options_row" arg-showExplain="{{ true }}" />" from "account_privacy" template but keep it in the preferences.

Added the below code but when you have the email options unchecked in preferences, and you save your settings in account privacy, it will check them again. So it does the reverse.

<xf:hiddenval name="option[receive_admin_email]" value="$xf.visitor.Option.receive_admin_email" />
<xf:hiddenval name="nable_activity_summary_email" value="$xf.visitor.last_summary_email_date !== null" />
 
You'd need to wrap the variables in curly braces, and any more complicated expressions in double curly braces:

HTML:
<xf:hiddenval name="option[receive_admin_email]" value="{$xf.visitor.Option.receive_admin_email}" />
<xf:hiddenval name="enable_activity_summary_email" value="{{ $xf.visitor.last_summary_email_date !== null }}" />

(If in doubt, double curlys should work for variables too.)
 
You'd need to wrap the variables in curly braces, and any more complicated expressions in double curly braces:

HTML:
<xf:hiddenval name="option[receive_admin_email]" value="{$xf.visitor.Option.receive_admin_email}" />
<xf:hiddenval name="enable_activity_summary_email" value="{{ $xf.visitor.last_summary_email_date !== null }}" />

(If in doubt, double curlys should work for variables too.)
Now that does the reverse. When saving in privacy, in preferences it unchecks them.
 
I've reverted all the templates back to default state. It was just too confusing and wasn't doing what I wanted it to. Just a little concerned now, that those who have edited their account details during that time, now have the wrong options selected/deselected. Oh well.
 
I've reverted all the templates back to default state. It was just too confusing and wasn't doing what I wanted it to. Just a little concerned now, that those who have edited their account details during that time, now have the wrong options selected/deselected. Oh well.
Let that be a lesson to never work on your live install ;)
 
Top Bottom