Home › Forums › Bug Reports › Plugin Bug / Conflict in Media Library Selection
Hi
The main ACF plugin causes a bug/conflict when trying to upload an image from the media library to another plugin option (the plugin is Slider Revolution from Codecanyon) – haven’t tried other plugin media library inserts nbut the issue is probably affecting other too. The Insert button remain un-clickable / blanked out unless the ACF plugin is deactivated in which case it works as anticipated. I would guess that as the deactivation of the ACF plugin resolves the issue that the problem probably resides here.
Can you please investigate and advise asap.
Many Thanks
Glennyboy
Hi @glennyboy,
That or the problem could reside in Rev Slider. 🙂
Can you please post any javascript errors showing in your browser developer tools console when you click the button?
Seems it could well be ACF:-
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:4
body.scrollLeft is deprecated in strict mode. Please use ‘documentElement.scrollLeft’ if in strict mode and ‘body.scrollLeft’ only if in quirks mode. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:304
body.scrollTop is deprecated in strict mode. Please use ‘documentElement.scrollTop’ if in strict mode and ‘body.scrollTop’ only if in quirks mode. load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jq…:304
Uncaught ReferenceError: acf is not defined
The last error in bold is flagged red.
Thanks
Glenn
Hi @glennyboy
The line Uncaught ReferenceError: acf is not defined
will occur if any JS error occurs before ACF is instantiated.
Any JS error starts a snowball effect where all following JS gets the blame.
Your origional error talks about event.returnValue
and body.scrollLeft
.
Perhaps these errors are comming from another plugin / theme code. Feel free to seach the ACF input.js file, but I don’t believe these errors are coming from ACF.
Thanks
E
Hi
That is from the error codes that I have pasted, but I would ask that you take a look as well – I’m not a script debugger and other things are likely at play here. Theme Punch (the Revolution Slider authors) identify a different script error relating to ACF (and also think it is ACF as it works fine once ACF is deactivated).
They took a screen grab of the error but it reads:-
ReferenceError: ACF is not defined
….1,”rules”:[{“field”:field_529eDa36aee13″,”operator”:”==”,”value”:”Sale”}],”aloo …
That relates directly to an ACF Conditional Logic field.
Regards
Glennyboy
Hi @glennyboy
I just logged in and had a look around on the post edit page and rev slider edit page. All image upload buttons are working fine.
perhaps the script that is causing the error is only loaded on your user?
Hi
To confirm I used your assigned login and wen to change the background image of the existing Revolution Slider. To my surprise it worked on first attempt. To confirm I exited the media upload and trued again, but on the second attempt it didn’t work again with the same error in the script debugger:-
[Error] ReferenceError: Can’t find variable: acf
(anonymous function) (undefined, line 4)
Can you please go back in and try to replicate.
I need your plugin for this site (launching now) and another critical site I’m also working on.
Many Thanks
Glennyboy
Can you perhaps make the ACF function ‘Global’ as per something similar here:-
Not sure if this is also similar:-
http://stackoverflow.com/questions/17648825/get-variable-out-of-anonymous-javascript-function
Hi @glennyboy
The acf object is global. There is not need to assume otherwise.
The issue really is that a JS error on the page is ‘snowballing’ and causing the ‘acf is not defined’ error.
Can you please setup your website on a local install? I have a feeling that it is due to the long load times and the fact that you are clicking the button before the window.load event is triggered.
Thanks
E
Hi
This is a script issue and there’s nothing wrong with the speed of the server that would influence loading in this way. This is the only error cross-sites that we get. Also please see developer comments from ThemePunch:-
“In general, what the ACF people have told you about a “JavaScript error snowball effect” is true. However, if other errors were occuring before their script runs (as per their claim), they would be visible in the browser’s debug console. To confirm this, open your browser’s debug console (I prefer Firebug with Firefox), click on the “Console” tab, then inside the slider’s admin, choose “Edit Slide”, then click on one of the slide’s main images to open up the media dialogue popup, then select an image and you’ll see the error appear in the console, and when this happens, it’s the only JavaScript error present (errors are highlighted in red). This essentially debunks the snowball theory.
If there were errors present coming directly from one of the slider’s JavaScript files (they’d be visible within the browser’s debug console), I could help you solve this. But because this isn’t the case, the best advice I can offer is to just disable the ACF plugin when using the slider’s admin.”
I’ve also tested in the same manner and this bears out.
Regards
Glennyboy
Hi @glennyboy
Thanks for the follow up. I’ve logged in again and taken another look.
It turns out your are most correct, and I have not fully understood your bug report.
It is only on CLICK of the image, that the error occurs. This is because your attachments contain ACF fields, at least 1 of which has conditional logic, but the edit slide page does not include the acf script.
I’m not sure how to fix this issue, as I can’t add in the acf script to this edit page… perhaps I will have to prevent the attachment fields from producing any JS.
Thanks
E
Hi Elliot
Thanks for double-checking and I’m glad that you have now replicated the error.
Other than this issue it’s a really useful plugin that I’m using ongoing in a number of projects so hopefully you will be able to find a solution to this asap with a plugin update.
Thanks
Glennyboy
Hi @glennyboy
I’ve just pushed an update to github which will fix this issue.
Can you please download and test?
Thanks
E
Hi Elliot
I regret that does not fix the issue.
Uncaught ReferenceError: acf is not defined
Please do feel free to login with details previously provided to check for yourself.
Glennyboy
Hi @glennyboy
Thanks for testing. i have made a few more minor changes, and it should now be fixed.
Can you download and test again?
Thanks
E
Yep Sorted!
Please do make this update available in your future version releases.
Although chained display rules for the ACF don’t seem to be working under this plugin version. I have post type only page and user role administrator, but it still shows on every post unless I remove the administrator user role ‘location’ rule.
Hi @glennyboy
Can you attach a screenshot showing the location rule setup which is causing the issue. it may be that you have not grouped them correctly.
Thanks
E
Hi There,
I noticed you fixed the error on the media library page. However, when using the plugin AdRotate Pro while having an extra field added to ‘attachments’ ACF still seems to output JS and causes the error:
Uncaught ReferenceError: acf is not defined
Is there any workaround or pointers that you could give me?
Thank you in advance,
Jos
The topic ‘Plugin Bug / Conflict in Media Library Selection’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.