ACF Conflict with Relation

Home Forums Calendar Products Events Calendar PRO ACF Conflict with Relation

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1064225
    Ryan
    Participant

    Greetings,

    After upgrading ACF (Advanced Custom Fields) to version 5.3.3.2 (on WP version 4.4.1 and TEC 4.0.5) the relationship fields no longer store values. For example, I have a relationship field to allow me to select from a custom Sponsors post type to apply those sponsors to specific events and since the update that field remains blank no matter what I do.

    I reached out to ACF and they did find the issue, but said it is on TEC’s end…here is the response from Elliot from ACF:

    I’ve just had the exact same issue reported, the good news is I found the issue!

    The events plugin is registering a version of Select2 (JS library) which is quite old.
    I believe this is what is causing the issue.
    If you look at the HTML, each selection is missing a hidden input, this also explains why selecting 1 value works, but not 2 or more.

    The solution is to prevent the event plugin from registering Select2 library.
    I would contact the Event plugin devs, or jump on google and find an existing thread for how to prevent the plugin from including Select2 due to a conflict in versions

    Is this something that should be looked in to on your end or something that I should seek a solution specific to my site? As I’ve seen a lot of previous threads about ACF (including relationship-related issues) I think it would be best to include a fix in the plugin itself. For now, I have rolled back ACF to version 5.3 and it is working again.

    Any thoughts?

    Thanks,

    Matt

    #1064604
    George
    Participant

    Hey Matt,

    Thank you for reporting this. This is definitely something worth looking into and fixing, and while there’s unfortunately no immediate action I can take on this bug itself, I will create a bug ticket for our developers to investigate this at some time in the near future. Hopefully, since we are hoping to update Select2 anyways, we can knock out this bug while improving the plugin itself.

    I’m sorry about the lack of immediate action here; but I appreciate you sharing this bug with us and am writing up a bug report right now.

    Let me know if you have any thoughts on this or any other questions I can help with!

    — George

    #1064710
    ejimford
    Participant

    This has caused a problem for me, too! Totally broke things for my clients. PLEASE have the developers fix this as soon as possible OR give us some instructions for how to prevent the select2.js library from loading!

    (Many thanks for the tip on downgrading to 5.3. Trying that now)

    • This reply was modified 10 years, 2 months ago by ejimford. Reason: (Adding thanks for a tip)
    #1065028
    George
    Participant

    I’m sorry to hear about this @ejimford – I made a bug ticket last night for this and it’s something we can hopefully address officially in the release after next, or the very next release if time allows (but, just to be frank, that is not likely because it is fast-approaching).

    To prevent The Events Calendar’s versions of Select2 from loading, you can add the following code to your theme’s functions.php file:


    add_action( 'wp_enqueue_scripts', 'tribe_events_disable_select2', 999 );
    add_action( 'admin_enqueue_scripts', 'tribe_events_disable_select2', 999 );

    function tribe_events_disable_select2() {
    wp_dequeue_style( 'tribe-events-select2-css' );
    wp_dequeue_script( 'tribe-events-select2' );
    }

    If all you do is use this code to remove the Select2 library from The Events Calendar, and do not then also offer your own version of Select2, the JavaScript on many pages will break. This is because many pages load JavaScript that calls Select2, so if you remove Select2, then this will cause a “not defined…” console error and break JavaScript on the page.

    I hope this help, though.

    Thank you for your patience with us as we work on an official fix for this!

    Cheers,
    George

    #1065055
    ejimford
    Participant

    Thanks so much for the reply and for looking into this. I have currently rolled my version of ACF back to 5.3, as suggested by Matt in the initial post. But, of course, not upgrading plugins is not really a long-term solution.

    I posed the same question to Eliot over at ACF, but maybe someone here can offer a suggestion: Can you think of a way to, in addition to dequeue-ing the select2 from tribe, doing an enqueue that uses the version of select2 from ACF or another more modern version? Just wondering if there is a fix that we can implement before the new release gets pushed out.

    Thanks, again, for you attention and your help with the dequeue-ing funciton.

    #1065915
    George
    Participant

    Hey @ejimford,

    Thanks for being cool despite a frustrating plugin conflict here, and for your patience with the delayed reply over the weekend. Happy Monday 🙂

    In regards to the bug, the bug ticket is created and as we near the launch of a new release, developer time will be newly allocated for the next release cycle and hopefully this is one of the bugs that makes it into that release.

    In the meantime, when it comes to enqueueing a better version of Select2, I downloaded the free version of Advanced Custom Fields to try and find the script; it turns out that it doesn’t exist in the free version of the plugin.

    So then it’s likely originating from a premium add-on for Advanced Custom Fields. Does this sound appropriate? Do you have any premium add-ons for Advanced Custom Fields on your site?

    If so, I would recommend uploading zips of these of these add-ons to a site like http://cloudup.com or http://ge.tt, and then sharing links to those zips. I will download them and look for the script there.

    Please note that this is not a shady file-sharing sort of thing 🙂 The plugins, even if premium, are GPL-licensed, so sharing them this way is at least legal and above-board. However, to be clear, I’m only requesting these files because I do not have them myself. I don’t use ACF so I’m only using these files to search for the script in regards to this issue.

    Once I’ve download the files I can let you know and then you can delete those links or anything you’d like – for this case, uploading the files to Dropbox might be a great alternative, too, since deleting posted files from that is quite easy…

    Apologies for the long post – let me know what you think here, and if you are able to post the files for your premium ACF add-ons, let me know what the download links are for those! 🙂

    Cheers,
    George

    #1066010
    ejimford
    Participant

    Sure thing! I’ll go ahead and post a Private Reply with the link to a download of the premium plugin, just to prevent people with less than savory tendencies from stealing the fine work of Eliot. Private reply with a link should appear right below this one.

    #1066011
    ejimford
    Participant

    This reply is private.

    #1066501
    George
    Participant

    Good call on the Private Reply, there – and thank you for sharing these files!

    I’ve been taking a look through them, and have found that ACF’s loading of its own version of Select2 is pretty straightforward. It labels its script simply ‘select2’, so to make it load everywhere it seems like copying and pasting its enqueue functions into the dequeue function I wrote above would do the trick here.

    So, like this:


    if ( function_exists( 'acf_get_dir' ) ) {

    add_action( 'wp_enqueue_scripts', 'tribe_events_disable_select2', 999 );
    add_action( 'admin_enqueue_scripts', 'tribe_events_disable_select2', 999 );

    function tribe_events_disable_select2() {
    wp_dequeue_style( 'tribe-events-select2-css' );
    wp_dequeue_script( 'tribe-events-select2' );

    wp_enqueue_style( 'select2', acf_get_dir( 'assets/inc/select2/select2.css' ), '', 'TribeTempFix' );
    wp_enqueue_script( 'select2', acf_get_dir( 'assets/inc/select2/select2.min.js' ), array('jquery'), 'TribeTempFix', true );
    }
    }

    I hope this does the trick – note that is a replacement of the original function I shared, so try deleting the old; adding the new; and seeing if anything improves. I apologize in advance if it doesn’t. Let me know!

    Thank you for your patience with this bug,
    George

    P.S.
    The bug has been reported in another, separate thread, which means we can bump the priority of the bugfix. I’ve done that, so hopefully it will lead to some more urgent allocating of attention on this bug.

    #1079848
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

    #1088725
    Leah
    Member

    Hello,

    Thank you for reporting this issue. We weren’t able to get a fix for it into our upcoming release (4.1). However, please know that the problem is still on our radar and is ticketed within our system to be addressed in a future maintenance release. We’ll do our best to keep you posted when we are able to get a solution in place. Thank you for your patience while we improve and expand our plugins.

    Best,
    Leah

    #1186701
    George
    Participant

    Hello!

    I wanted to post a quick note here that we have published a new Maintenance Release today that should address some of the problems reported in this thread.

    You can read about the details of this release here → https://theeventscalendar.com/maintenance-release-events-calendar-4-3-2-event-tickets-4-3-2-premium-plugins/

    I hope this update helps!

    If issues persist, open a new thread in the forums and be sure to include your site’s complete, un-edited “System Information” as per the instructions in this knowledgebase guide.

    Cheers,
    George

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘ACF Conflict with Relation’ is closed to new replies.