Arun Kumar
Member
Hello XenForo community,
I'm trying to implement a consent checkbox for adult/NSFW content in my XenForo Media Gallery (XFMG), but I'm running into some limitations with the available field types.
Current setup:
I've created a custom media field with these settings:
The issue:
When configuring the field type, I only see these options:
There doesn't appear to be any option for checkboxes or radio buttons in the media field types, unlike what might be available in other areas of XenForo.
What I've attempted:
I tried using a single-line text box with custom Value display HTML to simulate a checkbox:
And Wrapper display HTML:
Unfortunately, this workaround didn't function as expected.
What I'm trying to accomplish:
I need a way for users to acknowledge they're viewing adult content before seeing media in certain categories. Specifically:
1. A checkbox that users must check to acknowledge adult content
2. This should only apply to specific categories (like "Adult Art")
3. Ideally, the content would be blurred/hidden until the checkbox is clicked
Questions:
1. Are there additional field types available for Media Gallery that I'm missing?
2. Is there an add-on that extends the available field types for XFMG?
3. What's the recommended approach for implementing NSFW consent in the Media Gallery?
4. Would a custom template modification be more appropriate for this use case?
Any guidance would be greatly appreciated!
I'm trying to implement a consent checkbox for adult/NSFW content in my XenForo Media Gallery (XFMG), but I'm running into some limitations with the available field types.
Current setup:
I've created a custom media field with these settings:
- Field ID: adult
- Title: Adult Content Notice
- Display location: Below media item
- Applicable categories: Adult Art (and other relevant categories)
The issue:
When configuring the field type, I only see these options:
- Single-line text box
- Multi-line text box
- Rich text box
There doesn't appear to be any option for checkboxes or radio buttons in the media field types, unlike what might be available in other areas of XenForo.
What I've attempted:
I tried using a single-line text box with custom Value display HTML to simulate a checkbox:
Code:
<label class="nsfw-consent">
<input type="checkbox" id="nsfw_consent_{$fieldId}" class="nsfw-checkbox" {if $value == 'accepted'}checked="checked"{/if} onclick="document.getElementById('nsfw_text_{$fieldId}').value = this.checked ? 'accepted' : '';">
I acknowledge this media contains adult content
</label>
<input type="hidden" id="nsfw_text_{$fieldId}" name="custom_fields[{$fieldId}]" value="{$value}">
And Wrapper display HTML:
Code:
<div class="adultContentNotice">
<div class="adultWarningTitle">Adult Content Notice</div>
{$value}
</div>
Unfortunately, this workaround didn't function as expected.
What I'm trying to accomplish:
I need a way for users to acknowledge they're viewing adult content before seeing media in certain categories. Specifically:
1. A checkbox that users must check to acknowledge adult content
2. This should only apply to specific categories (like "Adult Art")
3. Ideally, the content would be blurred/hidden until the checkbox is clicked
Questions:
1. Are there additional field types available for Media Gallery that I'm missing?
2. Is there an add-on that extends the available field types for XFMG?
3. What's the recommended approach for implementing NSFW consent in the Media Gallery?
4. Would a custom template modification be more appropriate for this use case?
Any guidance would be greatly appreciated!
Last edited: