Skip Navigation

[Resolved] automatic link RFG to current loggged in user

This support ticket is created 5 years, 1 month 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 georgev-2 5 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1380795

Tell us what you are trying to do?

We have a RFG for users to add children info to their profiles. the children info is added via a front end form
however the way it is set at the moment is that users have to select their profile manually from a dropdown list in order for the RFG to be linked to the right user and thus profile.

I would like to make the form so that the current logged in user (the creater of the RFG) to be automatically set as "author" of the RFG
the way we currently have it with the manual selection is using

[cred_field field='@informatie-kinderen.parent' class='form-control' output='bootstrap' select_text='selecteer je profiel' author='$current']

so instead of manually selecting their own username from the dropdown to properly link the RFG to the corresponding user
I want to set the username automatically to properly link the RFG to the corresponding user

thanks in advance.
Best regards

#1381141

Shane
Supporter

Languages: English (English )

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

Hi George,

Thank you for getting in touch.

The [cred_field field='@informatie-kinderen.parent' class='form-control' output='bootstrap' select_text='selecteer je profiel' author='$current'] field using the author = '$current' wont auto select the post of the current author. What it does is that it will only display in the dropdown posts of that current author for them to select.

There is no option to have the value preselected like this unless you provide the ID of the post that is to be preselected in the URL.

Lets say you have a button on the Parent Post for this RFG and you have a button that says "Add new RFG" this way we can pass the ID of the parent post into the form when you click to the page and it will auto select he correct parent post for the RFG.

Please let me know what you think of this.

Thanks,
Shane

#1383055

thank you, what would be the best way to automatically include the correct ID in the buttons Url ?

#1383299

Shane
Supporter

Languages: English (English )

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

Hi George,

You can do this by setting a URL parameter for the field by using this field parameter urlparam='driver'

In my case i set it to driver since thats the parameter i want to use.

So an example is

		[cred_field field='@drivers-rfg.parent' class='form-control' output='bootstrap' select_text='--- not set ---' author='$current' urlparam='driver']


Once you've added the form itself to a specific page then you can link to it from the parent form like this.


<a href="linktomyform/?driver=[wpv-post-url]"> Link </a>

Please let me know if this helps.
Thanks,
Shane

#1386679

Thank you, I will give it a go.

#1386727
rfg.png

ok so I have tried it the way you described, but the RFG form/field still does not seem to grab the data from the URL.
it is still needed to click the dropdown and select the profile to which the RFG must be linked as you can see in the screenshot.

I would like it so that visitors dont have to click that dropdown and select their account in there.

I have tried is also with adding a value="$current" and some other combinations but that didn't work either.

#1386757

Never mind I got it to work instead of adding the [wpv-post-url] I needed the [wpv-post-id] to make it work, thank you very much for your help.

#1386759

My issue is resolved now. Thank you!