XF 1.5 How do you test a checkbox custom user field is not ticked in a notice criteria?

Stuart Wright

Well-known member
So I have set up a custom user field so people can tick it in their preferences to subscribe to the newsletter (and also when they register).

1527189219633.webp
I want to show a notice to people who are not subscribed inviting them to subscribe.
The notice custom user field criteria is set like this:
1527189336826.webp
The selection above indicates that the notice will show when the user choice is not selected. But the notice doesn't appear.
Am I misreading it now the criteria works?
If so, how can I test for non selection of the tickbox?
 
Unfortunately with checkbox fields, you can only target criteria for when they are checked, rather than when they're not checked. So it doesn't work how you think it does, effectively, though I can understand how that seems ambiguous.

You might be better off using a radio box with two choices "Not subscribed" and "Subscribed". You'll then be able to target the criteria when "Not subscribed" is selected.

Saying that, that might be problematic too as there's no "default" value for custom fields...
 
Unfortunately with checkbox fields, you can only target criteria for when they are checked, rather than when they're not checked. So it doesn't work how you think it does, effectively, though I can understand how that seems ambiguous.

You might be better off using a radio box with two choices "Not subscribed" and "Subscribed". You'll then be able to target the criteria when "Not subscribed" is selected.

Saying that, that might be problematic too as there's no "default" value for custom fields...
Yes I tried that, Chris and discovered that there needs to be a default set.
So I'm stuck, really?
I guess I need an addon which tests for unticked tickboxes?
 
There's definitely a non-add-on workaround for it.

If you create a user group promotion for users who have checked "Subscribe" (say to a "Has subscribed" user group) then you can use criteria to target users who are not in that user group.

It's a bit faffy, but guaranteed to work and has the desired effect.
 
Back
Top Bottom