Skip Navigation

[Resolved] setting up a field that only admins use to assign a catagory

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Shane 4 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1572459

Tell us what you are trying to do?
I have two categories single and couples
I need for the admin ONLY to be able to assign a category to a member(CPT)
Once that is assigned I need to be able to allow the user to choose from a set of taxonomies that are assigned to that type (single or couples)
I believe that I can do that fairly easily - it is the admin portion that I am concerned about.

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
hidden link

#1572695

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jessie,

Thank you for getting in touch.

Based on what I understand you want the Admins only to be able to assign the taxonomy to a custom post type. Then you want users to be able to select from those list of taxonomy terms when they are creating a new post in that post type?

Please let me know.

Thanks,
Shane

#1572699

sort of
So the admin assigns a PST the custom field - Coach LeveL (student, couple, single.....) and so forth
THEN depending on the level assigned a set of categories will be available on the update form (and this can be a separate form) so that they can select the categories they wish to show up in.

#1573339

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jessie,

I can see a few issue with this.

  • When will the Admin assign the post a custom field ? When it is being created?
  • If the admin already creates the post with the assigned custom field, how will the user create that same post ? They would essentially be editing an already created post
  • Finally are you saying the admin will only assign the custom field to the Post Type but not fill out that field? The user will go in and create a new post under that post type and fill out that field. From there only the Taxonomies relevant to that field will show up for the user to further select

I suspect that option 3 above is exactly what you want to achieve ? Please let me know if i'm correct and if further clarity is needed please let me know as I want to provide the exact solution where possible or advise of any alternatives.

Thanks,
Shane

#1573373

I am not worried about HOW the field is populated, as I have it working.

My concern is returning the search results as they want them returned. The (CPT) Does not even show up until it is created.
So the search is for users that have already completed their profile. When a visitor comes they are searching for Members (CPT) that have already completed the forms and selected their taxonomies.

The scenario should go as such - NO CPT's shown
visitor selects one of the coach focus options
(lets say singles) ALL CPT's that meet the singles criteria will show up AND a list of taxonomies that are matched to the singles coach's field

I currently have the coach's focus as a custom field.

#1573389

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jessie,

I am not worried about HOW the field is populated, as I have it working.

Ok so the query is NOT about creating the post but rather performing a search to find a list of post ?

Here is the new scenario.

  • A user goes to the search page to see a list of profiles
  • The user is presented with the fields : single, couples
  • The user selects Couples
  • Only the taxoxnomies relevant for couples is to be displayed on the search to further filter the list

I was under the impression that you were talking about creating a post, however now it seems that you are referencing to searching through the list of posts.

Thanks,
Shane

#1573397

So I have two support tickets open - I responded to your incorrectly
However - I think that I have it figured out - but you can maybe still help me.

This is what I have done:
a user creates a CPT (member) off of a form -
admin then completes the coaching focus field to one of the following (professional, single, couple)
THEN the user is prompted to go back and select three of the taxonomies that would be available to them
professional - sees both (single, couple) taxonomies and can select three choices (I have the code to limit choices)
single - see only the single coach taxonomies
couple - see only the couples coach taxonomies

I plan to create three different forms which I can controll access to via roles - BUT I would prefer to have it all done in one form that they return to and edit once the admin gives them a classification.

So sorry for the confusion

#1573423

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jessie,

Ok I understand now. The 3 forms method would definitely be simpler than using one form. However it is possible to use one form.

Here is how you can achieve it with 1 form

  • Create your form as you would normally do and add all the fields to it, including the one that the admin is going to fill out.
  • Toggle the form into expert mode because we will need to use our access plugin to hide the field that the Admin will fill out. This field will only be available to Admins to check. Using the Post title field as an example this is how you can hide it so only admins can fill it out.
  • [toolset_access role="Administrator" operator="allow"]
    <div class="form-group">
    		<label>Post Title</label>
    		[cred_field field='post_title' class='form-control' output='bootstrap']
    	</div>
    [/toolset_access]
    
  • The above uses our Access plugin shortcode to restrict in page content. See more details here https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/
  • After doing this you can then use the built in conditionals for your form to further restrict the taxonomies based on the field the admin selects.
  • In the Expert mode you should see a button above the editor called "Add Conditional Groups"
  • You can use this button to add various conditionals for your other fields. So you can set your taxonomy fields to be dependent on what the Admin selects
  • Finally you can even setup notifications so when the admin edits the form then a notification will be sent.
  • Assuming that the user would've already created a basic profile then this would essentially be an Edit form where the admin and user can edit but some fields will be hidden to the user.

This should help to resolve your issue using a single form.

Thanks,
Shane