Hi,
I have a custom post type (CPT) which has a Title (single line text), a Content (Multiline Text) and an Image custom field (CF).
I want to create forms for creating and editing them, but I want to allow only specific WP roles ( Extended CPT Author) to be able to upload image to this CPT, others (Basic CPT Author) can not upload that , only able to set the CPT's Title and Content.
I don't want to allow to upload any other type of file and I want to allow 1 per a specific CPT (like a Featured Image).
I do it for security reason.
I've set up Access to manage this CPT, copying the Author capabilities of default posts to this CPT.
I've already read this:
https://toolset.com/documentation/user-guides/front-end-forms/conditional-display-for-form-inputs/
Reading the above I supposed I can set up much more general conditions in a Form Conditional Group, but I can't!
I wanted like this:
IF user role = 'Extended CPT Author' THEN show image upload option, ELSE don't.
I can only set up such conditions which are related to CF Group used with that specific CPT, but not such standard WP post, term or user conditions!
Any solution idea or workaround is appreciated,
thank you!
Hello,
I suggest you try with Access shortcode [toolset_access], check if current logged-in user has specific user role "Extended CPT Author", then display the show image upload option.
See our document:
https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/
Hi,
I gonna check your idea, thank you.
Could you send me a link to Access shortcodes page (like Views and Forms have), I don't find them googling even
"Access shortcodes site:toolset.com"
string,
and I need the available shortcode parameters.
In other threads client was referred to use
Views conditional output
( https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/ )
where we can use much more conditions to evaluate.
Will it work in a form definition, in my case?
Thank you
There isn't existed Access shortcodes document page.
For the question:
where we can use much more conditions to evaluate.
Will it work in a form definition, in my case?
In your case, I suggest you try with Access shortcode [toolset_access], [wpv-conditioal] shortcode might involve some custom codes.
Then how others work with Access shortcodes, if they don't know the available parameters and valid values?
Also, in Form Editor, even in Expert Mode, Access elements are not available.
Even if I want to create this Access shortcode in a test page ( supposing I gonna have an Access GUI or like that there), Access elements are not available in Block Editor and also not available in Classic Block, where Views, Forms, Conditionals are available
I'm afraid I have to drop this idea and figure out a totally different approach...
Thanks for the details, you are right, there isn't button for Access control within Toolset form editors, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it.
Currently, you can setup the access shortcode manually, for example:
[toolset_access role="Extended CPT Author" operator="allow"]
here ...
[/toolset_access]
Please replace "Extended CPT Author" with your custom user role's name