Skip Navigation

[Resolved] Cannot create repeatable fields group

This support ticket is created 4 years, 11 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 12 replies, has 2 voices.

Last updated by Christian Cox 4 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1233294
REPEATABLE.jpg

We are trying to create a repeatable fields group but when we create a new custom fields gropu and assign it to only a post type as explained in the tutorial , we do not see the red button to add a repeatable field but we only see the button "add a new field".
We attach a screenshot. Texts are in italian but they are self explaining.
Kindly let us know what could be wrong.

Thanks
Franco

#1233584

Hi, it looks like the updated relationships feature is not active on this site. Please go to Toolset > Relationships. You will see:
1. A dashboard list of post relationships.
- OR -
2. A message telling you to migrate to the new post relationships system.

If you see #1, something strange is happening because this is not normal. I must take a closer look. If you see #2, this indicates your site was built before the new post relationships system was introduced in Types 3, and you have not migrated to the new system yet. To use repeatable field groups (RFGs) and other post relationship features, you must run the post relationship migration process.

I recommend you make a full backup of your site including the database before migrating to the new post relationships system. More information about relationship migration: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/

#1234151

Hi Christian, we did not migrate Toolset to the new system, we will do a backup and start the migration process, after that we will let you know if the new repeatable group fields are working.
Best,

Franco

#1234694

Okay sounds good.

#1236029
relationships-issue.png

Hi Christian,
we made a full site backup and started the migration process, when the setup started we got the message you see in the attached screenshot.
It seems that some custom code is not backward compatible to the new migration, since maybe it is something that we asked you to create in the past support tickets is it possible for you to investigate if something from the screenshot suggests how to change that code to be backward compatible?
The alert we got from the migration process says that it could be a false alarb but we need to check it before proceeding with the migration.
If you need further info, kindly let us know.
Thanks in advance for your great support.

Franco

#1236653

Okay I see the message. The code referenced here must be adjusted to work in the new relationships system. It does not matter if we perform this change immediately before the migration or immediately after, but it should be performed together with the migration. I need to see the functions.php file to know exactly which changes should be made. Please zip up your functions.php file and post it in Dropbox or Drive and post a download link here for me. I'll review the code and follow up with you soon.

#1236654

Hi Christian,
please allow me a private reply so I can send you the link of the .zip file.
Thanks.
Franco

#1236661

Sure, private reply is enabled here. The fields may say something about a Duplicator clone, but any download link is fine.

#1236712

Okay it turns out we need to know the slugs of the new post relationships to be able to finish this code modification. So I would activate maintenance mode to take the site offline, then run the migration. Once you have run the migration, go to Toolset > Relationships and find the slugs of the two one-to-many relationships. Replace studi-relationship with the new studi relationship slug, and replace scheda-relationship with the new scheda relationship slug. Then replace the existing function in functions.php with this one before opening up the site again:

add_filter( 'wpv_filter_query', 'filter_both_parent_types', 10, 3 );
function filter_both_parent_types ( $query, $view_settings, $view_id ) {
  global $post;
  $views = array( 113600, 113684 );
  $studi_rel = 'studi-relationship';
  $scheda_rel = 'scheda-relationship';

  /* -- do not edit below here -- */

  if( in_array( $view_id, $views) ) {

    $studi_id = $post->ID;
    $scheda_id = $query['post__not_in'][0];
    $args = array(
      array(
        'role' => 'child',
        'related_to' => $studi_id,
        'relationship' => $studi_rel
      ),
      array(
        'role' => 'child',
        'related_to' => $scheda_id,
        'relationship' => $scheda_rel
      )
    );

    $query['toolset_relationships'] = $args;
  }
 return $query;
}

Then test out the View and make sure it's working as expected.

#1236713

Hi Christian, thanks for your help. I will do all things as you requested and let you know if everything wil be OK.
I will do that in the following days because I have to check first with the client when it will be the best moment to put the site in manteinance mode.
Anyway thanks for your great help as usual 🙂

I would keep this ticket open until the migration will be made if you don't mind.

Best,

Franco

#1236721

Sure, no problem. The system will prompt you to update the ticket in a few days to keep things open.

#1249417

just to keep the ticket open, next week we will do the upgrade of Toolset plugins.
thanks

Franco

#1250251

No problem, thanks for the update.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.