Hello,
In my "Add classified" form I am trying to automatically create a one-to-many relationship where parent is always the current user (profile). None of the followings works:
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='[wpv-post-id item="wpv-current-user"]']
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='[wpv-post-id item="wpv-user-id"]']
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='[wpv-user field="id"]']
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='$current']
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='wpv-post-author']
[cred_field field='@profilo-classified.parent' class='form-control' output='bootstrap' author='$current' value='[wpv-post-id item="@profilo-classified.parent"]']
Actually users don't need to see this field so I'd prefer a generic field like this:
[cred_generic_field type='hidden' field='@profilo-classified.parent']
{
"default":"[wpv-current-user info='id']" (this doesn't work either ...)
}
[/cred_generic_field]
Please help, thanks
Regards
Nicola
Hello. Thank you for contacting the Toolset support.
I would like to understand the structure you have.
As I understand you have custom post type "profilo" that holds the user profile and every user will have one user profile post with custom post type "profilo". Is that correct? If yes:
- To identify the what profile post belongs to what user you set the post author so we know what profile post belongs to what user.
Can you please share all above information is correct or if its different how its setup.
Exactly right Minesh,
I am trying to create the relationship between the classified that the user is adding and its own profile (that is just an extension of the user profile). With the relationship I will be able to show profile (parent) info on the single classified CT.
ok - Can you please share admin access details and where you exactly added the form on what page and let me review the current strcture, one I review that I will be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've created the following view that is set to query your profili post type and I've added the Query Filter for post author where post author is current loggedin user and this view will return the post ID of profili post.
Post author filter
Select posts with the author the same as the current logged in user.
=> hidden link
Now, with your form I've adjusted the parent field as given under:
=> hidden link