doublesharp
Forum Replies Created
-
Hi Rishabh,
You would need to have the functionality to record the product codes (outside of the validation plugin) once it is successfully submitted. Assuming you store the code in the database you can then use the PHP validation to see if the code exists and return an error. The best way to do this would be to create an API around your functionality, then the validation would look something like:
if ( MyUtilClass::productCodeUsed( $value ) ){ return "The product code {$value} may only be used once."; }
Forum: Reviews
In reply to: [WordPress Beta Tester] Cannot Return to Stable Releases….To be fair, I think they are offering you some free development and you are chastising them for also not offering free support. What if you offered to pay for help?
Just a thought…
The other submitted fields are available in the validation function as the
$inputs
variable. If you want to compare to other values that aren’t part of the submit you can usethe_field()
or the built in WordPress functions to access the meta values.Thanks for catching this – can you check out https://github.com/doublesharp/validated-field-for-acf for the latest code (the plugin is mostly rewritten with a lot of new functionality). Should release on the WP repository it soon.
Forum: Plugins
In reply to: [PayPal for WooCommerce] Proceed to Checkout Button is backThe priority changed from 10 to 20 and you have to be specific in
remove_action()
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20);
Forum: Plugins
In reply to: [Multicons [ Multiple Favicons ]] Broken!You are seeing this error because the
multicons.php
file is adding a function to theplugins_loaded
action hook, but the function it’s adding –multicons_init()
– doesn’t exist.There are two fixes for this. First, you can just comment out the line at the top of the
multicons.php
file. The second is probably prefered as it doesn’t edit the plugin files.In
functions.php
add the following:// check to see if this exists (added back to the plugin?) if ( !function_exists( 'multicons_init' ) ){ function multicons_init(){} // create a function that does nothing }
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] calculated dateHI @fmalinge – this plugin is designed to validate inputs of a particular field, but it can’t set the values of other fields. I do have an add-on planned that would be able to accomplish this, but it won’t be ready in the near term.
Looking at your sample code, you probably want to hook to the meta update actions for the
date_from
field, then update your other meta field value. See this StackOverflow post for more info: https://wordpress.stackexchange.com/questions/16835/how-to-hook-update-post-meta-and-delete-post-metaadd_action( 'added_post_meta', 'my_after_post_meta', 10, 4 ); add_action( 'updated_post_meta', 'my_after_post_meta', 10, 4 ); function my_after_post_meta( $meta_id, $post_id, $meta_key, $meta_value ){ // check if it is the "date_from" meta key that was just updated if ( 'date_from' == $meta_key ) { // use the $meta_value to calculate 2 months in the future $date_to = date( 'd-m-Y', strtotime( '+2 month', strtotime( $meta_value ) ) ); // update the "date_to" value update_post_meta( $post_id, 'date_to', $date_to ); } }
Hi Ed,
I ran into this issue as well and updated the code, you can find the latest here: https://github.com/doublesharp/validated-field-for-acf/blob/master/v5/validated_field_v5.php#L202
The latest version of the plugin is still beta quality, but should be wrapping it up for production soon.
J
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Uniqueness to Relation fieldUnfortunately this isn’t working correctly in the current version of the plugin, but I am working on version 2.0 that will handle this much differently.
The issue is that the relationship field values are stored as an array of post IDs which is then serialized before it’s saved to the postmeta table. To make things trickier, you can resort the selected values if more than one is allowed which resulted in some funky LIKE statements to try and detect dupes.
The new version will hook into the field update and save the individual IDs to their own meta keys, along with a sorted array which we can rely on to determine uniqueness.
Couple that with repeater fields and the new support for User and Option meta fields, and the code that generates the SQL statements has gotten a little crazy. Nearly 500 lines :/
The latest code can be found here https://github.com/doublesharp/validated-field-for-acf, but note that it is still a little buggy (and I haven’t checked in the new relationship code, should have that in a few hours).
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Uniqueness to Relation fieldHi @leonardo_ndo,
Is it not working for any of the unique settings or one in particular? Can you let me know what version of ACF, Validated Field, and WordPress you are using?
Thanks!
Hi @edsoltani –
Unfortunately the current version of Validated Field doesn’t support Flexible Content fields, however the development version does (along with a lot of other new features.). If you would like to give it a try, you can download it from https://github.com/doublesharp/validated-field-for-acf, however keep in mind that it’s still in development so there might be bugs. That said, I would welcome any feedback and help in testing the new version.
For your second item, I’m not sure that I understand the issue. Are you hoping to have the values in a Relationship field filtered by post type? This functionality is included in ACF and isn’t part of the Validated Field plugin. When you select Post Type + Meta Key it is determining if the value is unique for that post type and meta key.
Thanks!
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Unique globally on front end editAre you specifying a post_id in the acf_form() on the front end? Can you share any sample code? It would also help to know the version of the plugin and WordPress that you are running.
Forum: Plugins
In reply to: [Advanced Custom Fields: Validated Field] Unique globally on front end editHi @thiagoareias, I’m not sure I understand your issue. The validation is working on the front end but not the back end?
The “globally unique” option means that the value should be unique regardless of the meta key or post that it is attached to. I added this option for good measure, but typically the unique option you want is “Post Type + Meta Key”.
Can you provide a bit more information about what you are trying to do?
Forum: Plugins
In reply to: [Remote Content Shortcode] new window on clickHi @parlla,
If I understand you correctly, you would need to create a blank page that just contains the shortcode to load the remote content, and then on the page you want the link you add your nofollow and target=”_new” parameters with the href targeting the page with the shortcode.
Hope that helps!
Hi @charlkri8itcom,
Just to make sure I understand the issue, you are using
acf_form()
on the front end of your site, and within the function call you are specifying a differentpost_id
than the the ID of the page that the form is embedded on?Assuming that is what you are trying to do it looks like you are correct that it’s grabbing the wrong post_id. I’m currently working on a new version of this plugin with lots of new features and support for some add-ons as well, so this fix will probably need to wait until that is ready, which hopefully should be soon. One thing to note is that the fields used by Validated Field in the form post have been placed into their own array element, hopefully to prevent conflicts.
I haven’t tested this at all, but this is the code I dropped into the 2.0 version
<script type="text/javascript"> (function($){ $(document).ready(function(){ if ( $form = $('form.acf-form') && $form.length ){ $form.append('<input type="hidden" name="acf[acf_vf][post_ID]" value="' + acf.o.post_id + '"/>'); $form.append('<input type="hidden" name="acf[acf_vf][frontend]" value="true"/>'); } }); })(jQuery); </script>