Home›Toolset Professional Support›[Resolved] Split: Limit the parent post selector for a form to publish repeatable field groups to own posts
[Resolved] Split: Limit the parent post selector for a form to publish repeatable field groups to own posts
This thread is resolved. Here is a description of the problem and solution.
Problem:
A front-end form is used to publish repeatable field groups and includes a select dropdown to specify which post the group belongs to. Client wants this dropdown to only show the user's own posts, not all posts.
Solution:
Add the attribute author="$current" to the cred_field shortcode for the parent post selector field.
This support ticket is created 6 years, 2 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.
I have repeater fields in it. So I made two separate forms for those pieces of content.
Repeatable Problem Solution Fields Form (ID: 994)
Work History Repeatable Fields form for Expert Profiles (ID: 996)
Here is an example link hidden link
It works fine. I only want to make sure that other users cannot update someone else's content.
At the moment , by filling the form at hidden link
You can update anyone's profile content through the repeater fields form.
It seems like to add problem solving fields to an expert profile, right now you just have the form added to the page add-problems-you-would-like-to-solve/. The form includes an expert select dropdown, and you can add fields for any expert.
In that case you would normally hide the parent selector with CSS, but that wouldn't stop someone determined to mess with your site to use the browser inspector to change the selected expert.
However, you can add an author attribute to the cred_field for the parent selector, which can take an actual user id, or you can use $current for the currently logged in user.
Right now you have this for your parent selector field in your form:
[cred_field field='@pobz-solving-exp.parent' select_text='--- not set ---' class='form-control' output='bootstrap']
To only show experts in that dropdown that were published by the current user you could add:
[cred_field field='@pobz-solving-exp.parent' select_text='--- not set ---' class='form-control' output='bootstrap' author="$current"]
Thank you very much Nigel. That author="$current"] was very powerful solution. It works very well. It is definitely a dream come true as the site starts working the way we want it to. Thank you..