Skip Navigation

[Resolved] Filtering items diplayed in a relationships 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.

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)

This topic contains 0 replies, has 1 voice.

Last updated by nicolaS-3 1 month ago.

Assisted by: Minesh.

Author
Posts
#2785812

Hi,
I have two CPTs (Groups and Profiles) related by a MM relationship Group-Profile. When the relationship form is displayed to users to create a new Group-Profile relationship the select box in the form always show all items available in the other CPT. I'd need to know if it's possible to filter the available items only to those satisfying a specific condition. In my case I have created two single text fields - one in Groups called group-check and the other in Profiles called profile-check - and I'd need that in the form select only Profiles where profile-check = group-check are listed. Is there a way to do this ?
Thanks Regards
Nicola

#2785930

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

There is no such feature available to filter the posts in relationship form.

But if you can send me admin access details and problem URL where you added the relationship form and tell me what is your expected results with both parent and child dropdown with the relationship form and using what custom field you want to filter the result.

*** 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.

#2786107

Minesh
Supporter

Languages: English (English )

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

Sorry this is still not that clear to me.

Basically, there is no filter available to filter the relationship form post but I would like to review your requirement and see if I can offer you any workaround but for that I will require all workflow step by step information with URLs.

Additionally, Do I need to login as frontend user? if yes:
- Can you please share frontend user access details as well as on what link I can see the relationship form.

Also, please share the link of the content template that will help me to understand I'm checking the same content template you are talking about.

I have set the next reply to private which means only you and I have access to it.

#2786240

Minesh
Supporter

Languages: English (English )

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

Now I'm not able to login as Toolset_support (admin) user. Can you please send me working access details for admin user.

Also, can you please tell me with what post you set the access code and where?

What I loggedin as "killer" user and visit the following page:
=> hidden link

I can see the form but I do not see any band is available to connect? Generally, it should offer all bands - right?

#2786552

Hello Minesh, I made some new tests, pls open private message again, thanks

#2786621

Minesh
Supporter

Languages: English (English )

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

I have set the next reply to private which means only you and I have access to it.

#2786657

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

Relationship form uses another library and to translate the required field message I've added the following custom JS code to your relationship form's JS editor:
=> hidden link

jQuery(document).ready(function($){
  
  $('.cred_rel_form_class').attr("data-parsley-required-message","Questo campo è obbligatorio");
 
});

Can you please confirm it works as expected.

#2786658

Hello Minesh,
that one works now, thanks, what about the others ?
No bands can be associated to
No results can be found searching:

thanks

#2786663

Minesh
Supporter

Languages: English (English )

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

#2786682

Yes, pls find the list of translations as currently in my functions.php


add_filter( 'gettext', function( $translated_text, $text, $domain ) {
   if($text == 'Search for a post' && $domain == 'wp-cred'){
      $translated_text = "Seleziona una band";
    }
   if($text == 'No bands can be associated to ' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band da associare a";
    }
   if($text == 'No results can be found searching: ' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band disponibile ";
    }
   if($text == 'Enter address' && ($domain == 'toolset-maps')){
      $translated_text = "Inserisci l'indirizzo";
    }
   if($text == 'Add new' && ($domain == 'wp-cred' or $domain = 'wpv-views')){
      $translated_text = "Aggiungi";
    }
   if($text == 'Please enter %NUM% or more characters' && $domain == 'wpv-views'){
      $translated_text = "Digita almeno %NUM% caratteri";
    }
   if($text == 'Hour' && $domain == 'wpv-views'){
      $translated_text = "Ora";
    }
   if($text == 'Minute' && $domain == 'wpv-views'){
      $translated_text = "Minuti";
    }
   if($text == 'Use my location' &&  ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Usa la mia posizione";
    }
   if($text == 'Show/Hide coordinates' && ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Mostra/Nascondi coordinate";
    }
   if($translated_text == 'Get New Password' and   ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Imposta una nuova password";
    }
   if($text == 'Username or Email' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "IDUtente/Username oppure Email";
    }
   if($text == 'Latitude' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Latitudine";
    }
   if($text == 'Longitude' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Longitudine";
    }
   if($text == 'Closest address:' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Indirizzo più vicino:";
    }
   if($text == 'Use this address' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Usa questo indirizzo";
    }
   return $translated_text;
}, 10, 3 );


#2786809

sorry I deleted this

#2786943

Hello Minesh,
while you still have access to my site, in the same Profile CT I list the bands which the current profile is related to. I'd like the current profile to be able to delete the link even though the relationship was created by another user. The view I created first was looping on the bands related to the current profile, but the link never shows unless the current user is also the relationship author.
I've also changed the view as you suggested here:
https://toolset.com/forums/topic/link-delete-relationship-not-visible/
but not even the cred-delete-post-link is shown !
Any clue ?
thanks

#2786951

Minesh
Supporter

Languages: English (English )

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

As per our support policy - we entertain only one question per ticket.

May I kindly ask you to open a new ticket with every new question you may have. This will help other users searching on the forum as well as help us to write correct problem resolution summery.

I've adjusted the code you added to functions.php file as given under:

add_filter( 'gettext', function( $translated_text, $text, $domain ) {
   if($text == 'Search for a post' && $domain == 'wp-cred'){
      $translated_text = "Seleziona una band";
    }
   if($text == 'No %POST_TYPE_LABEL% can be associated to %OTHER_POST_TITLE%' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band da associare a";
    }
   if($text == 'No results can be found searching: %SEARCH%' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band disponibile ";
    }
   if($text == 'Enter address' && ($domain == 'toolset-maps')){
      $translated_text = "Inserisci l'indirizzo";
    }
   if($text == 'Add new' && ($domain == 'wp-cred' or $domain = 'wpv-views')){
      $translated_text = "Aggiungi";
    }
   if($text == 'Please enter %NUM% or more characters' && $domain == 'wpv-views'){
      $translated_text = "Digita almeno %NUM% caratteri";
    }
   if($text == 'Hour' && $domain == 'wpv-views'){
      $translated_text = "Ora";
    }
   if($text == 'Minute' && $domain == 'wpv-views'){
      $translated_text = "Minuti";
    }
   if($text == 'Use my location' &&  ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Usa la mia posizione";
    }
   if($text == 'Show/Hide coordinates' && ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Mostra/Nascondi coordinate";
    }
   if($translated_text == 'Get New Password' and   ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Imposta una nuova password";
    }
   if($text == 'Username or Email' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "IDUtente/Username oppure Email";
    }
   if($text == 'Latitude' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Latitudine";
    }
   if($text == 'Longitude' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Longitudine";
    }
   if($text == 'Closest address:' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Indirizzo più vicino:";
    }
   if($text == 'Use this address' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Usa questo indirizzo";
    }
   return $translated_text;
}, 10, 3 );

Where, I've modified two strings:

if($text == 'No %POST_TYPE_LABEL% can be associated to %OTHER_POST_TITLE%' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band da associare a";
    }
   if($text == 'No results can be found searching: %SEARCH%' and ($domain == 'wp-cred' or $domain == 'wpv-views' or $domain == 'toolset-maps')){
      $translated_text = "Nessuna band disponibile ";
    }

Can you please confirm it works as expected.

#2786955

Hello Minesh
yes, this now work as expected. I suggest you create a page for listing all translations which need this, I suppose other users have the same issue.
thanks
I split the other one as per your request.