David Bee
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] Required Fields are not being validatedAfter doing some basic plugin conflict testing, turns out there’s some conflict with the “Options Framework” plugin (which is required by my theme). Can you take a look?
Forum: Plugins
In reply to: [Contact Form 7] Required Fields are not being validatedHi, here you go: https://www.davidbawiec.com/contact/
Hi @adeelkhan
Correct, this occurs even after clearing caches.
Forum: Plugins
In reply to: [Maintenance] Add filter for who is considered “logged in”You got it! Done!
And thanks for looking into it! Appreciate it!
Cześć Konrad!
Thanks for your patience and the super quick response!
I’d written this complete response, and then just as I was about to post it, I decided to do one more test and finally found the issue!! So here’s the complete process of what I found:
So to answer your question:
I am plugged into init via:add_action( 'init', array( $this, 'setup' ) );
. So as such I’m plugging in on priority 10. So well past the initial hook.Within the setup method I have (among many other things):
add_action( 'admin_menu', array( $this, 'admin_menu' ), 999 );
This is what sets up my admin page (with submenu item under the ACF Custom Fields menu item:
public function admin_menu() { add_submenu_page( 'edit.php?post_type=acf-field-group', 'Update Old BB Fields', 'Update Old BB Fields', 'administrator', 'update-old-bb-fields', array( $this, 'admin_page_display' ) ); }
So you can see this ends up calling the ‘admin_page_display’ method, which is what ultimately tries to call my ‘get_field()’. So technically I’m hooked into init 10, and things SHOULD work, but they don’t. Somehow, ACF Extended PHP AutoSync fields don’t show up.
I tried moving the
add_action( 'admin_menu', array( $this, 'admin_menu' ), 999 );
hook out of ‘init’ to just have it hook directly, but that isn’t giving any success either. And at that point, I’d be firing atadmin_menu:999
, which is long after ‘init’ priority 5 so things should work flawlessly.I even tried running the same tests hooked into add_action( ‘load-custom-fields_page_update-old-bb-fields’,…). And it also returned the same negative result. Somehow the fields aren’t being registered on admin.
This is when I got one more idea. What if, ACF fields don’t get registered on ACF admin pages?? So I moved my sub_menu_page to the Tools menu item instead using:
add_submenu_page( 'tools.php', 'Update Old BB Fields', 'Update Old BB Fields', 'administrator', 'update-old-bb-fields', array( $this, 'admin_page_display' ) );
And BOOM! Suddenly everything works like a charm. So it seems as though the fields don’t get registered when visiting the Custom Fields (ACF) admin pages. Does that sound right to you?
David
I feel like I’ve reached a whole new level of stupid. *face-palm*.
DUH. Thank you!
This was a marvelous idea! Thanks!
DavidI love your copy-paste response to every query. But this does not relate to the PRO version. It relates to the basic version of the plugin as well. So I’d appreciate your help in either resolving the problem or pushing through this feature request.
Thanks!
This should apply to all template files.
For example:
/wp-content/plugins/bookly-responsive-appointment-booking-tool/frontend/modules/booking/templates/3_time.php
/wp-content/plugins/bookly-responsive-appointment-booking-tool/backend/modules/appointments/templates/index.phpAnd so many more that reside in /template/ directories between the regular version and various pro add-ons.
Ah. Totally see the goal there. And wish that could be possible! 🙂
Sadly, in the case I’m talking above, the plugin already implements Select2 and modifies it’s style internally. So ACF-Extended ends up overriding some of those settings, thus resulting in a mess.To be fair though, if this seems to be a rarity that would cause you more of a headache to fix, I can also override the modifications locally. It’s no big deal. Let me know.
Have a great weekend!
Thanks!
DavidAh! I’ve found the issue in my logic!! It was totally my fault.
You’re right things work like a charm. Thanks.Since I’ve got you, I’m wondering if you can shed any advice. So I’m trying to dynamically create the ACF form with certain field_groups. Rather than using keys, I rather use field group names and retrieve the key for each name.
To retrieve the key of a field group, when they were defined the regular ACF wp-admin way, I used to do this:
$field_group_IDs[] = get_page_by_title( $field_group_name, OBJECT, 'acf-field-group' )->ID;
Which of course doesn’t work when I’ve now switched to registering the field groups locally via php. So the way I’ve found to find them from the local store is as follows:
$field_group = acf_get_local_store( 'groups' )->query( array( 'title' => $field_group_name ) ); $field_group_key = array_key_first($field_group);
Does this seem like the most efficient way of retrieving these?
Thanks!
David- This reply was modified 11 months, 1 week ago by David Bee.
Thanks for the tremendously fast response!
I’m using the acf_form() function to create the front-end form. https://www.advancedcustomfields.com/resources/create-a-front-end-form/
Hmm.
So I don’t think I was clear in my previous message as I think we misunderstood each other.
Upon looking through the plugin’s code, I can see that your input-script.js eventually triggers not only the Advanced Custom Fields WordPress Media upload modal, but ultimately the openModal() function, which handles the rest of ACF Image Aspect Ratio Crop’s actions (opening the modal, cropping the file, updating the attachment, etc).
So in theory, wouldn’t work if I were to create a dropzone field which on success triggers the same openModal() function?
Thanks.
PS- and of course I’d be happy to do a pull request so that this could get incorporated into the plugin.
- This reply was modified 11 months, 1 week ago by David Bee.
That’s marvelous news! Looking forward to the fix!
Also, may I say: I love you Trello gifs. 😉
Cheers!
DavidOn a side note, while you’re checking this out, one more thing I did notice is that what gets deleted are the cropped versions, not the original uploads or the various thumbnails. This may be an issue with the bug described above. But while you’re looking, can you make sure that original versions will also get deleted?
Thanks!
David