Skip Navigation

[Gelöst] Non Toolset relationship

This support ticket is created vor 5 Jahren, 1 Monat. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Dieses Thema enthält 18 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 5 Jahren, 1 Monat.

Assistiert von: Minesh.

Author
Artikel
#1362987

Hello

I have a CPT 'Person' and a user will only be allowed to create one 'Person' they then go on to create a CPT "Partner Page' and again will only be allowed to create one of these. The problem is that I need to pass some of the field values from one CPT to the other. So I follow theses steps

1. Create a single and unique CPT "Person' with fields a, b, c, d
2. Go to next page and create CPT 'Partner Page' which automatically fills in 2 of the fields with a and c from previously created CPT 'Person.

I shall look forward to hearing back from you
Regards
Geoff

#1363099

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand - you are using Toolset Form to create new entry for CPT 'Person' and when you submit this form you want on next page where you added another form few entries should be automatically loaded. If this is correct - the approach you followed is correct.

Please check the following Doc:
=> https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

#1363717

Hi Minesh

Good to hear from you again... Thanks for your help as always..

I understand the cred_field shortcode but I'm just not sure how to pass the information from one screen to the next so an example:

SCREEN 1
Create Person 1 - CPT 'Person' - Form
Name: James
Colour: Blue
Number: 88377773

SCREEN 2
Create CPT 'Partner Page'
Hat Size: (User inputs size)
Partner: (Name for CPT Person 1 from Screen 1 - i.e. James)
Partner's Colour: (Colour for CPT Person 1from Screen 1 - i.e. Blue)

Hope that makes sense..

Best regards
Geoff

#1364011

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Well - you can use the Toolset Fomr's redirection hook: cred_success_redirect
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

where you can add the redirection to your page and add your field values as URL param and use that URL param key with your another form field's urlparam attribute.

Please check the following related ticket:
=> https://toolset.com/forums/topic/url-parameter-value-is-not-set-for-the-field-inside-a-cred-form/#post-655270

#1364221
Partner Pages.jpg

Hi Minesh

Thank you for getting back to me...I understand how the cred_success_redirect could work to redirect to a new page but not sure how I would pass parameters from another post type and there is also a situation where I would want to create a CPT 'Partner Page' from just clicking on a link rather than from a form. So ideally I need some code that allows me to access the first created CPT 'Person' whenever they get to the create CPT 'Partner Page' Form..

I will attach a proper diagram of what I'm trying to achieve...

I also need to merge the first name and the surname from the CPT 'Person' into a hidden field on the create 'Person' page.

Hope that makes sense..

Best regards

Geoff

#1364233

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

If you can create two page where you add two different forms and send me access details I would be happy to share the solution for you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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.

#1364361

Hi Minesh

I'm still developing this area which is why I wanted your help before I make mistakes...any pointers would be great..obviously I'll get back in touch if I can't make it work..

Just some code hints for the functionality in the diagram would be fantastic please.

Hope you're doing good...

Speak soon

Geoff

#1364965

Hi Minesh...

Ok I have been doing some work on this and have found some solutions..so lets start again from the beginning!

I have 3 problems:
1. When I'm in Access Control to set permissions for my various user roles for the various forms it will not save my changes.

2. I have a form with 3 fields - (first-name, surname and full-name) - When submitting the form I need for the full-name field to be automatically filled and saved with the first name and surname merged with a space between
e.g.
first-name: George
surname: Dawson
full-name: George Dawson

3. I have a CPT 'PERSON' that the user creates but can only create one of so - $person[0] I also have a CPT 'PARTNER PAGE' that again the user can only create one of so $partner_page[0]... When I go to the create 'PARTNER PAGE' or the edit 'PARTNER PAGE' I want the fields:
first name
surname
Automatically filled with the first name and surname fields from the CPT PERSON ($person[0])
I need to create some hook that retrieves the PERSON information whenever the create PARTNER PAGE or edit PARTNER page is called

I shall look forward to your response

Best regards
Geoff

#1365401

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I've split the ticket for questions 1 and 2. I will handle the original question you raised with this ticket that is the following question:

3. I have a CPT 'PERSON' that the user creates but can only create one of so - $person[0] I also have a CPT 'PARTNER PAGE' that again the user can only create one of so $partner_page[0]... When I go to the create 'PARTNER PAGE' or the edit 'PARTNER PAGE' I want the fields:
first name
surname
Automatically filled with the first name and surname fields from the CPT PERSON ($person[0])
I need to create some hook that retrieves the PERSON information whenever the create PARTNER PAGE or edit PARTNER page is called
===>
Can you please share the access details and problem URL where you added the form.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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.

#1366211

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Ok - but where I can access the first step? where did you add the first step form?

#1366231

Hi Minesh

Ok I have removed your partner-page so you can go through the process.. the first step can be from one of two places. If you don't already have a CPT 'partner-page' then you would click on the 'invite my partner button on this page which will take you to the above mentioned page:

versteckter Link

if you have already created a partner-page by following the above step then you will want to edit the existing partner page by starting on this page:

versteckter Link

And clicking the '50% off for my partner' button which takes you to:
versteckter Link
This page has the edit form for the existing CPT partner-page (edit-content-partner-pages-1) - (ID: 12769) ..but again I need it automatically filled in with the first-name and surname of the users CPT Person with field 'Partner'='Yes' i.e. the first record [0]

To summarise on both these forms:
'Create content - Partner Pages 1' (ID: 2038)
'edit-content-partner-pages-1' - (ID: 12769)

I need the fields:
partner-first-name
partner-surname

filled with
'partner-first-name' filled with first-name(from CPT PERSON[0])
'partner-surname' filled with surname(from CPT PERSON[0])

Best regards

Geoff

#1366233

Sorry Minesh..I forgot to add that in your case I have created your CPT 'PERSON' with field 'Partner=Yes' and given them the fields:

first-name: Sarah
surname: Jones

Regards
and thanks as always
Geoff

#1366265

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I've made little bit of changes. I've added the conditional statement you added outside the view's loop - I've moved it to inside the view's loop.
=> versteckter Link

As you can see now, I've passed the first_name and last-name as URL param with the invite-your-partner link as you can see below:

[wpv-conditional if="( '[get_user_role]' ne 'member' )"]<div class="buttonz-box"><a class="buttonz" href="<em><u>versteckter Link</u></em> field='first-name'][/types]&last_name=[types field='surname'][/types]">Invite Your Partner <span class="vc_icon_element-icon fa fa-arrow-right"> </span></a></div>[/wpv-conditional]

Now, when you click on "Invite Your Partner" button - it will catch the values passed to it based on the URL param first_name and last_name because - with the Toolset form:
=> versteckter Link

As you can see we added the URL param;

<div class="form-group">
		<label>Partner's First Name</label>
		[cred_field field='partner-first-name' post='partner-page' value='' urlparam='first_name' class='form-control' output='bootstrap']
	</div>

<div class="form-group">
		<label>Partner's Surname</label>
		[cred_field field='partner-surname' post='partner-page' value='' urlparam='last_name' class='form-control' output='bootstrap']
	</div>
#1366335

Hi Minesh

Ok great ..thank you.. So the first part works now passing the parameters from versteckter Link to versteckter Link

but now I need to click on the '50% off for my partner' button on the
versteckter Link
page
which takes you to:
versteckter Link

And the same thing has to happen here that the fields need to be filled in from the CPT 'PERSON' [0] with 'Partner' field = 'Yes'... but at the moment it defaults to the saved CPT 'partner-page' 'partner-first-name' and 'partner-surname' ---

so if I delete the existing PERSON here (versteckter Link) by clicking 'Remove Partner' and then click 'Add Partner' the Partner Page will still show the old name...so currently your partner is 'Sarah Jones' but if you remove her and create another called 'Sally Smith' (which will still be CPT PERSON[0] the edit form for your partner page (versteckter Link) will still be profiled with Sarah Jones:

So somehow we need to pull the fields from CPT PERSON[0] to pre fill the 'partner-page' edit form.

Hope that makes sense

Thank you!

Regards
Geoff

#1367551

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Let me review the whole flow and I'll get back to you as soon as possible tomorrow.