My site is membership based. Each user can create only one member profile.
Reviews are Children of both Books and Members.
Each review must be assigned to a Book parent post and the Member parent post of the currently logged in user.
When a user is viewing a Book post, there is a link to 'review this book', when they click this link they are taken to the Book review page.
The Book parent selector is prepopulated already, with the book post from the originating link.
As my site may have hundreds of users, each with a member post, I needed the Member parent post selector to only include, and if possible, better yet be prepopulated with the current users Member post.
The php function I added to my themes function.php and the javascript on the form, that you gave me at the beginning of this support thread, worked perfectly, in that it only displayed the member post of the currently logged in user in the dropdown.
So the dropdown basically had one member post available to select.
Brilliant, thank you Minesh.
However the dropdown would still require the user to select the Member post to assign it to. The default state was 'no parent selected'...
It would be great, if it was possible to prepopulate the Member parent field with the currently logged in users Member post. So that when they clicked the 'review this book' link they were taken to a CRED Book review post form that had both of its parents (Book & Member) already assigned.
Then the user could just write their review, and submit, without having to touch any selection dropdowns.
It would be even better if the Member post parent selector was hidden as then the user experience would be more seamless.
(I decided not to hide the Book post parent selector as it functionally lets them know which book they are reviewing, but seeing their Member post is unnecessary).
---
In short, I would like the parent selector for:
[cred_field field='_wpcf_belongs_member_id' value='']
To be prepopulated/autopopulated with the Member post of the currently logged in user, and hidden.
---
I must apologise for asking for so much help, the function and javascript you provided me worked brilliantly and I hope I am not asking too much.
Jeff