# User custom field toggle for sidebar (SFW Mode)

**URL:** https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342
**Category:** Marketplace
**Created:** [March 7, 2023, 9:14am UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342 "2023-03-07T09:14:24Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 9:14am UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/1 "2023-03-07T09:14:24Z")

</div>

**What would you like done?**

I need to add new button to Sidebar (or some other place possible to discuss too), which will simply toggle user’s custom field value. We set up “SFW” mode, by basically [inverting this approach](https://meta.discourse.org/t/our-solution-for-blurring-nsfw-content/124584). But as the value is optional to set by user and the website is NSFW by default, it would take time for one user to get into their profile settings in order to find tiny and non-evident checkbox.

That’s why the idea of putting a button with two states (On/Off) which will change the custom field’s value for the user. The default state is NSWF (unchecked user’s field, or 0). The second state is SFW (checked user’s field)

**When do you need it done?**

It seems to me it should be a quick task for experienced theme-component developer 🙂 Take your time

**What is your budget, in $ USD that you can offer for this task?**

Name your price. Sounds like an easy job.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [March 7, 2023, 9:50am UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/2 "2023-03-07T09:50:34Z")

</div>

Maybe I’m interested in this work?

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 9:52am UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/3 "2023-03-07T09:52:35Z")

</div>

I’m not sure if this is a question to anyone 🙂 Let’s work 🙂

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 7, 2023, 12:21pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/4 "2023-03-07T12:21:06Z")

</div>

This theme-component maybe combined with welcome Link Banner?

> [@User Field Prompt](https://meta.discourse.org/t/user-field-prompt/185214):
>
> discourse2Summary User Field Prompt allows you to show a [user field](https://meta.discourse.org/t/how-to-create-and-configure-custom-user-fields/113192) form in any Discourse post.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/user-field-prompt)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-user-field-prompt](https://github.com/discourse/discourse-user-field-prompt)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features User Field Prompt allows you to show a [user field](https://meta.discourse.org/t/how-to-create-and-configure-custom-user-fields/113192) form in any Discourse post. Changes made in the form will …

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 1:30pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/5 "2023-03-07T13:30:08Z")

</div>

What an awesome theme-component [User Field Prompt](https://meta.discourse.org/t/user-field-prompt/185214) is! No matter how frequent I visit Discourse Meta, it’s always amazing to find something new about Discourse.

The task described is different from the concept of post fields. And it’s also not intended to play with other theme components like Welcome Link Banner you mentioned.

The maximum customization I see now is introducing basic customization options like:

- Discourse Text-fields for admin to be able to Create/Update/Delete buttons based on example of numerous theme components like [Custom Header Links (icons)](https://meta.discourse.org/t/custom-header-links-icons/86307)

- Admin could give button:

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 7, 2023, 3:05pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/6 "2023-03-07T15:05:12Z")

</div>

Okay haven’t played with it yet. but there is also page publishing.

I would imagine the code may help to get some ideas. There are a few components that use user fields. A more recent addition is a kind of watched words for the member that will hide? posts with word term.

There are also some theme-components that use a switch toggle in iirc Hamburger menu or header.

Custom header links may work as well possibly.

I am not sure but with a checkbox? you might be able to copy the link for that user prefer checkbox.

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 3:12pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/7 "2023-03-07T15:12:12Z")

</div>

Sorry, I lost you on the first couple of sentences as I don’t think these are related to the topic above.

P.S. You have SSL certificate expired for the website in your Bio 🔓

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 7, 2023, 3:17pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/8 "2023-03-07T15:17:31Z")

</div>

Thanks need to update the site address. The client changed from.ai to .com. :facepalm:

The idea I meant above. You could look at the source fir the User field prompt to get an idea for the code you need to toggle your nsfw user setting. Then look at maybe something like the Thene-component Light/Dark toggle and combine ideas for the toggle to manipulate your nsfw user setting.

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 3:30pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/9 "2023-03-07T15:30:53Z")

</div>

Okay, now I get it. Well, you seem to be inventing the wheel of this solution I mentioned in the first post: [Our solution for blurring NSFW content](https://meta.discourse.org/t/our-solution-for-blurring-nsfw-content/124584)

It does what you talk about. Looks into the user’s field value and sets CSS class via JS. Please make sure you use the [code from this message](https://meta.discourse.org/t/our-solution-for-blurring-nsfw-content/124584/5) as the base one, because the one used in the first post there relies on deprecated Discourse methods.

In addition, you can look into this: [CSS Classes for Current User's Groups](https://meta.discourse.org/t/css-classes-for-current-users-groups/226068) to adjust the look & functionality of your website based on user’s groups 🙂

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 7, 2023, 3:33pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/10 "2023-03-07T15:33:12Z")

</div>

As for toggle itself, and your reference to [Dark/Light toggle](https://meta.discourse.org/t/dark-light-mode-toggle/215585/), I guess it may be interesting to look into it for the future developers of this component I’d like to share to public as soon as it’s finished. @Lhc_fl is working now on something and we will hopefully be able to test it ourselves in production first 🙂

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 7, 2023, 3:40pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/11 "2023-03-07T15:40:31Z")

</div>

That is quite cool. I am still very much a novice learning coding. Still quite a bit to learn.

From what I have seen Lhc\_fl is very talented.

---

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [March 9, 2023, 6:18pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/12 "2023-03-09T18:18:53Z")

</div>

It’s done: [Sidebar User Field Toggle](https://meta.discourse.org/t/sidebar-user-field-toggle/257634/1)

![Yep Reaction GIF by C H A R L Ö T T E](https://global.discourse-cdn.com/meta/original/4X/1/a/f/1af6a0ccf264eed21247d0f837d1ab2549ec3b62.webp)

Thank you, @Lhc_fl ❤

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 8, 2023, 6:19pm UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/13 "2023-04-08T18:19:31Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
