Show Radio Button Option to Admin only

By: Carrol Fleming | Asked: 10/01/2022
ForumsCategory: Code SnippetsShow Radio Button Option to Admin only
Carrol Fleming asked 2 years ago
Hi there
Is there any way to show a radio button option to admin users only?  I want a membership level that only the admin can select when editing an entry. Thanks  
3 Answers
Victor Font answered 2 years ago
You can set the field's visibility in the advance panel. Visibility Settings
Carrol Fleming replied 2 years ago

Thanks, but it is not the whole field I want to hide, just one option so the user can select options 1, 2 or 3 but only admin see and select option 4. It is for a membership site where the registration options are paid but in the background, there is also a free option that the Admin can allocate.

Victor Font replied 2 years ago

You can hide single options with CSS, but why wouldn’t you just use a separate field just for the admin?

Carrol Fleming replied 2 years ago

It is a required field so we need an option.

Victor Font replied 2 years ago

<p><p>If it’s admin only and the end user has the option hidden on the front end and can’t see it, you could easily use a separate admin only field for the free option.</p><p>Doing it this way will be a lot easier than writing the code to use conditional CSS that hides the option of not an admin and show shows it when viewed by an admin. That’s a combination of PHP and CSS. </p></p>

Carrol Fleming replied 2 years ago

The other options are required, it is for a business chamber, members apply and select a payment option depending on the turnover of their business. Using the value setting this then passes the amount to the email/invoice so it is a required field. There are also honourary members such as other chambers and diplomatic missions, these do not pay and are added by the admin, hence access to the free option.

Later down the line, a view is exported with the values so that the secretariat can reconcile invoices, we cannot have the honourary members with an amount value. I also have a search view where members can be listed by membership etc.

I could do a conditional field but it would be so much easier to just have the first three options visible to the general user and the last only visible to the admin.

I am comfortable with adding php and css, but as I mentioned above my brain is tired from working everything out every step of the way. My fault for trying to build this from scratch but I have tried and rejected a few membership plugins, each one seemed to throw up a problem that could not be worked around, not be user-friendly or too expensive to download on the off chance with too short a trial period (still waiting for a refund from one plugin). I am also designing for a not too technical secretariat.

For some reason, there are not many other sites with Formidable help so one is fairly limited to the Formidable documentation/tutorials. I am happy to be self-taught but every once in a while it just becomes a pain.

Walter JonesWalter Jones answered 2 years ago
Hi Carol,

Not to sound condescending…but if the purpose is to create an admin only option, that only the admin can select, why does it matter if the admin only options are a completely different radio field?  

It seems like having two radio fields, one that anyone can see with your first 3 options and then a second radio field with only your admin options (but set with visibility) that only a Wordpress Admin) can see would solve your issue.  You can filter your views using that field. Perhaps we still don’t understand your work flow, but this seems very straight forward.  
Carrol Fleming replied 2 years ago

<p>But as a required field, editing will throw up an error if there is no value so to save the record I would need to select one option - ie, the hidden option.</p>

Carrol Fleming answered 2 years ago
Thanks all for nudging me in the right direction. I have done it with php and css

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right