Skip Navigation

[Resolved] Pass memberpress sponsor level to Toolset form as default value of taxonomy 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 6 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1146981

One more question- we are using memberpress for the first step in the UX-they fill out a memberpress sign up form for the specific sponsor level (we're using memberpress because it handles integration of multiple recurring payment levels).

Then they will follow a link to fill out a CRED form for their business listing. I prefer that they don't have to click to choose a category on that CRED form for their sponsorship level, since they've already chosen their level and paid. Is there an automated way to have a CRED form for a specific taxonomy? Or will we have to manually apply the correct taxonomy to their post later? (Which we don't want to have to do)

#1146984

Hi,

I assume you are using Toolset form shortcode [cred_field] to setup the "sponsorship level" taxonomy field, there isn't such a built-in feature to pass default value to taxonomy field in Toolset form, see our document
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
Arguments:
value. Optional. Preset value ... Does not apply to all field types, e.g. taxonomies.

You are right, in your case, you can apply the correct taxonomy to their post later, but automatically with custom codes, for example:
1) In your Toolset form for creating "sponsor" post, you don't need to setup the "sponsorship level" taxonomy field
2) After user submit above form, you can use action hook "cred_save_data" to to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
3) In this function, you can get current user's ID, with wordpress function
https://developer.wordpress.org/reference/functions/get_current_user_id/
With user's ID, get user's "sponsorship level" setup by memberpress plugin
hidden link
Then update "sponsorship level" term's value the speicific single "sponsor" post.
https://codex.wordpress.org/Function_Reference/wp_set_object_terms

For your reference.