[Resolved] Relationship form

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.

This topic contains 20 replies, has 2 voices.

Last updated by Luo Yang 1 month, 3 weeks ago.

Assigned support staff: Luo Yang.


Hi Luo,
I will not be able to set up the site for the demo befor next Wednesday, because I am out of the office for a few days, gathering data for my client. Sorry.

Yesterday, I was looking for an alternative way to create that Favourite Collection feature for logged in users.
I found an Elementor plugin, Dynamic Content for Elementor, bydynamic.ooo, with an "Add to Favorites" widget : an Elementor Button widget, which stores Posts (any kind) data directly into the logged in user meta. To display the stored posts, a "Views" widget displays them either in a list or a grid.
I started to test them yesterday : you can see the start of thisimplementation here :

The Elementor Template "Oeuvre standard" with the "Add to Favorites" widget :
- hidden link
Frontend url :
- hidden link (without the Toolset Relationsip

The Elementor Test page with the Views Widget :
- hidden link
- Frontend url : hidden link

Again, I am reluctant to rebuild the "Ouevre standard" in the Block editor, for the reasons I mentionned above, and also because I am under pressure for completing the site : besides those structural features, I have to add a lot of content (about 300 more "Oeuvres"/paintings/sculptures etc. with detailed descriptive documentation). My client has now a fixed deadline : the site has to be online on June 11, with all the features.

But I am interested to see the demo, because I might use the process for anothe site later.
I will update here on Tuesday morning at the latest.

Best regards,
Francesco De Grandi


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

OK, please update here when your test site is ready. thanks


Hi Luo,
Thank you for your patience.
I backed up the test site and then I put the "Oeuvre standard" Elementor template in the Trash.
It is ready for the demo.

I can't wait to see what you come up with!
Best regards,
Francesco De Grandi


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I have done below modifications in your website:
1) Create a content template for single "Oeuvres" post: Single Oeuvres post CT
hidden link
Display below post view "My member posts"
Edit "Oeuvres" post, in section "Content template", choose above content template:
hidden link

2) Post view "My member posts":
hidden link
- Query " Membres" posts
- Filter by:
a) Select posts in a Membres Oeuvres relationship that are related to the Post where this View is shown.
b) Select posts with the author the same as the current logged in user.
- In views loop, display "Membres" post link + delete relationship link:

[cred-delete-relationship role_items='$fromViews' relationship='membre-oeuvre' redirect='self']Delete this relationship[/cred-delete-relationship]

- within shortcode [wpv-no-items-found] ... [/wpv-no-items-found]
Display the relationship form shortcode:
[cred-relationship-form form='formulaire-de-favoris-2' parent_item='[my-member-post-id]' child_item='$current']

It will use current "Oeuvres" and "Membres" post ID of current logged-in user as default value

3) Create a shortcode [my-member-post-id] to get "Membres" post ID of current logged-in user
hidden link

 * New custom code snippet (replace this with snippet description).

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

add_shortcode('my-member-post-id', function($atts, $content){
	$args = array(
    	'post_type'	=> 'membre',
      	'author'	=> get_current_user_id(),
      	'posts_per_page'	=>1,
      	'fields'	=> 'ids',
  	$posts_array = get_posts( $args );
  	$res = '';
      $res = $posts_array[0];
  	return $res;

4) Dashboard-> Toolset-> Settings-> Front-end Content
hidden link
in section "Third-party shortcode arguments", add above custom shortcode name: my-member-post-id

To test it in front-end:
1) you will need to create login your website, and create your own unique "Membres" post
hidden link

2) Go to the "Oeuvres" post
hidden link
you should be able to see the relationship form, and test again


Hi Luo,

Thank you for the demo. I already had a Member login for myself and I could test.
The relationship form seems to work, and connects the current "Oeuvre" to the current "Member".
On the Front End, in order to minimize the display of the Relationship form/template in the Single Oeuvres post CT, I hid the title "Connect with my member post" and the 2 select-inputs with a display="none" CSS style.

But I have two main concerns :
1.- Relationship form : I would like to be able to customize the text of the submit button
2.- The Front End Form for creating a Member ("Formulaire pour Membres" : hidden link) is not working peoperly :
- it creates a Member with a coded Title , example : CRED Auto Draft 6926e6c1df579115a27f0beb86d68a06
- consequently, the forms cannot fulfill the condition (Member name = logged in User) : the view displaying the Member's Oeuvres related posts is : "Membre: publication créée par l'utilisateur identifié (logged in)", hidden link ; to check the display on the Front End : hidden link

Thank you for checking these 2 issues.

New threads created by Luo Yang and linked to this one are listed below:



Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

For issue 1) I would like to be able to customize the text of the submit button
You can edit the relationship form:
hidden link

In section "Form Editor", find and edit the submit button shortcode:
[cred-form-submit field='submit' name='submit']
Add attribute "lable" in it, for example:
[cred-form-submit field='submit' name='submit' label="Mettre dans ma collection"]

See our document:
label. Optional. Sets the submit button label. Defaults to Submit if not set.

For other issues, please check the new ticket here:

According to our support policy, we prefer one ticket one question, thanks