doublesharp
Forum Replies Created
-
To grab a ZIP of the latest in master from GitHub, use https://github.com/doublesharp/validated-field-for-acf/archive/master.zip
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] WPML supportHi Günther,
Finally got a chance to merge your code. Some other changes had been made to the plugin as well, so I had to modify your code a bit. I was able to test the non-WPML version just passing
array( (int) $post_id )
which works, so I suspect the WPML version will as well. The other change I made was to pass theNOT IN
values through$wpml->prepare()
viacall_user_func_array()
. Please let me know how it works for you.The code is available here as well https://github.com/doublesharp/validated-field-for-acf
@mickfilipe, @waltercruz, @gabyferman, @johnny_br – finally got some time to work on this some more.
@mickfilipe, @waltercruz here are some updates for the issues you saw.
1 – this was a conflict between the built in “required” validation and the server side validation. The plugin has been updated to only check the server side validation once the client side validation passes.
2 – thats the built in “error” CSS for ACF, but it looks like you are missing a message for some reason… possibly a server side error. I can’t get this to fail like you are seeing, so can you check your PHP error log? That said even explicitly adding bad code gave me a message ofPHP Error: syntax error, unexpected '}', line 9.
3 – again, this was built in validation vs this plugin’s validation. I am only running the latter if the first passes however, so the message at the top should update accordingly.@gabyferman you can download it from the same link: https://www.dropbox.com/s/0gf6ghesups12b7/validated-field-for-acf.zip
@johnny_br thanks! I’ve updated the code to correct this.
I also ran into an issue with the default “colors-fresh” admin theme being loaded by ACF when
acf_form_header()
is called, specifically setting a min-width of 763px on #poststuff. The following will immediately dequeue it if you want to use all your own styles.add_action( 'acf/input/admin_enqueue_scripts', 'remove_acf_form_style' ); function remove_acf_form_style(){ wp_dequeue_style( array( 'colors-fresh' ) ); }
Forum: Fixing WordPress
In reply to: Trouble with Plugin Updates (false update notification)I ran into this issue when I manually updated a plugin that was due for an update, specifically Admin Columns Pro. I had to do this due to the way ACP updates and lack of full support for multisite so I just copied the new version of the plugin to the server rather than having to auto-upgrade. From that point on I had a 1 in my Update Notifications and next to Plugins, but visiting either page showed no updates.
I disabled and re-enabled Admin Columns Pro and the notification disappeared.
EDIT: nevermind, it re-appeared shortly after.
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] WPML supportThanks! I’ll see if I can get it merged into the next version. Would you be able to test it out as I don’t have any WPML sites?
It’s not easy to share with the WordPress svn repo, so i might set up a github repo as well for pull requests like these. I’ll post the info if I do.
Thanks also for catching the email issue… Not sure what went wrong but it should be working now (if you used info@doublesharp).
Soon, but it might be another week. Currently trying to launch the business that this plugin was originally written for (but not using the front-end piece so it’s not blocking) and at the same time clearing brush from some rural land – high tech/low tech diversification.
Sorry for the holdup, I’m aiming to have a bug free version early next week, but hey, at least it’s free ??
J
Forum: Plugins
In reply to: [Remote Content Shortcode] Not sure what I am doing wrong hereI’m seeing the same results you are – it seems like a problem parsing the DOM. The only interesting thing I noticed so far is that the “P pen” elements are using double quotes (
"
) and the rest are using single quotes ('
). I will follow up if I can figure out what is going on.Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Date validationYes, it can validate a date using the PHP validation – really you can do pretty much anything you want with the PHP using the
$value
argument. StackOverflow is a great place to look for help with questions like these, but all you need to do is convert the String to a Date usingstrtotime()
and then do the comparison using the results ofdate()
.// make sure the date isn't empty and is in the format yyyy-dd-mm or change for your format if ( empty( $value ) || ! preg_match( '~\d{4,4}-\d{2,2}-\d{2,2}~", $value){ $message = 'You must enter a valid date'; return false; } else { $input_date = strtotime( $value ); // input date in seconds $today_str = date( 'Y-m-d' ); // date as string based on current timestamp $today = strtotime( $today_str ); // today's date on the server in seconds for comparison if ( $today < $input_date ){ $message = 'The date cannot be in the future. Today is ' . $today_str . ' and you entered ' . $value; return false; } elseif ( $today == $input_date ){ return true; // the date is today } elseif ( $today > $input_date ){ return true; // the date is in the past } }
If you haven’t downloaded it, I just put an updated version at the same link if you care to give it a try. The global settings have now been moved to a settings page in the Admin under “Custom Fields > Validated Field”. You want to check the box to enable validation on the front end and save.
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] ACF5For the Field Type/Type de champ you must selected Validated Field, and then then a sub field of type Text/Texte. This plugin wraps other field types to provide validation for them.
Sorry – now my parents are in town so I haven’t had a chance to finish testing, plus I’m trying to make some of the global settings easier to manage (options page vs constants).
If you want to give the dev version a try you can download it from here, then add
define( 'ACF_VF_FRONTEND', true );
to yourwp-config.php
. It would be great if you could let me know either way if it works for you or not.Thanks!
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Numbers with thousands separatorHi Julio,
I think this is an issue with your pattern and not the plugin. Try this one out:
^\d{1,3}(,\d{3,3})*
You can see it working at Regex101.com – good place to test yourself as well to make sure you’re matching what you think you are.
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] ACF5Do you see the “Validated Field” type and then the area to enter you validation doesn’t appear, or you don’t see the field type at all once the plugin is enabled?
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] ACF5The current release of ACF is still 4.x, and I haven’t done any testing with 5.x yet. I will update it, but if you could let me know what isn’t working it will definitely help.
You can validate any type of field, so a textarea should be fine. It just takes the value and sends it to the back end for validation so you wouldn’t know you had written too much until after it was submitted.