beng56
Forum Replies Created
-
Hi again,
I don’t know why it didn’t work with the other hooks I was using (acf/save_post or wp_insert_post), but by using the following hooks :
add_action( ‘added_post_meta’, ‘wp_afterpostmeta’, 10, 4 );
add_action( ‘updated_post_meta’, ‘wp_afterpostmeta’, 10, 4 );I managed to trigger my code.
You can close the ticket ??Best,
Benoit
Hi,
It worked for a part of my code, but not everything. Indeed, I need to access user data, but also from another user than the one making the ACF update. I can access to user data with AutomatorWP but not someone else, even though I have access to his email for example.
It didn’t solve completely my issue. I guess, if there is not way to run my code, I will have to add some user data inside the post meta ..
Beno?t
- This reply was modified 3 years, 8 months ago by beng56.
Hi,
Thanks, I will follow the coming updates.
Best,
Benoit
Hi,
I had to adapt it a bit as I have now my post tag as multiple selection but thanks to your tips, I managed to adapt it.
I mark it as resolved.
Best regards,
Benoit.Hi,
I’m updating the post metas.
I understand what you mean and I better understand how it works.
Indeed, now I agree, at it is the filter cannot access to this meta data.
I will find another way by for example adding by coding a hidden field to forminator with the needed data.
You can close the topic.Thanks for your help, I’ll give a 5 star rating ??
Best,
Benoit
- This reply was modified 3 years, 9 months ago by beng56.
Hi,
I understand that, but in my action (before the filter), it manages to update this post data so AutomatorWP should also has access to it for filtering.
Here, forminator is only used for triggering the automation and getting the post ID, I’m not using forminator form field values to update post values.
I guess I can manage to do it with custom coding if no solution can be found here.
Thanks anyway for the support !
Benoit
Hi again,
Thanks for your reply. Indeed not setting the value works fine, my bad… And for the time, it does the job, thanks !
Looking deeper into my issue, I’ve found out it might be bigger.
Let me explain to you my automation (quite simple):
– trigger a form submit from forminator plugin
– update a post meta data IF this post data is empty.
Here you can find a screenshot : https://drive.google.com/file/d/1VqEgIMH9NMktW2lzFuZ97_NYI2-GPar7/view?usp=sharingLet’s say that “comuna_postulation_1” has empty value at the beginning. What happens is that “comuna_postulation_1” has its value updated with user_meta thanks to automatorWP. This part works well.
But if I change the post meta value, the filter cannot get this value. I’ve tried as you see in the picture with post_meta but it doesn’t get the value, it always returns “” although it has a value. It’s weird because in the WordPress action part it manages to update the value for meta_key comuna_postulacion_1, so it means forminatorWP has access to it. How access it with the filter ?
What could cause the issue is that the form is included in a post template page and maybe he is lost between the post template page and the actual post where the user submit the form..
In the wordpress filter, I have access to user meta but not post meta so I have to use the flat condition.
Any idea in order to make it works ?
Thanks,
Benoit
- This reply was modified 3 years, 9 months ago by beng56.
Hi,
Thanks a lot, this is just what I needed !
I just had to change the post tag field type to multiple in order to make it work.
But it doesn’t matter as I make those fields readonly.Below I will put the code I have been using in case it might be useful to someone.
I’m quite sure it’s not an optimized code or nicely written one but at least it works :). This example has been written for a 3 tags option.<script> jQuery(document).ready(function ($) { // Update if any value is updated var val_changed = ""; // tag fields readonly $('#postdata-1-1-post_tag').attr('disabled', 'disabled'); $('#postdata-1-2-post_tag').attr('disabled', 'disabled'); $('#postdata-1-3-post_tag').attr('disabled', 'disabled'); //get value from radio field $('input[name=radio-3]').change(function(){ var value = $( 'input[name=radio-3]:checked' ).val(); // conditions on radio field value and on the tag value. // The 2nd condition is useful if the user changes the radio field value // I simply call again the jquery.prop in order to deselect the old value on tag field if (value == "Value1"){ if (val_changed == 'Value2') { jQuery("#postdata-1-2-post_tag").prop("checked", true); jQuery('label[for="postdata-1-2-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-1-post_tag").prop("checked", true); jQuery('label[for="postdata-1-1-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value1"; } else if (val_changed == 'Value3'){ jQuery("#postdata-1-3-post_tag").prop("checked", true); jQuery('label[for="postdata-1-3-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-1-post_tag").prop("checked", true); jQuery('label[for="postdata-1-1-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value1"; } else { jQuery("#postdata-1-1-post_tag").prop("checked", true); jQuery('label[for="postdata-1-1-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value1"; } } else if (value == "Value2"){ if (val_changed == 'Value3') { jQuery("#postdata-1-3-post_tag").prop("checked", true); jQuery('label[for="postdata-1-3-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-2-post_tag").prop("checked", true); jQuery('label[for="postdata-1-2-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value2"; } else if (val_changed == 'Value1'){ jQuery("#postdata-1-1-post_tag").prop("checked", true); jQuery('label[for="postdata-1-1-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-2-post_tag").prop("checked", true); jQuery('label[for="postdata-1-2-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value2"; } else { jQuery("#postdata-1-2-post_tag").prop("checked", true); jQuery('label[for="postdata-1-2-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value2"; } } else if (value == "Value3"){ if (val_changed == 'Value1') { jQuery("#postdata-1-1-post_tag").prop("checked", true); jQuery('label[for="postdata-1-1-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-3-post_tag").prop("checked", true); jQuery('label[for="postdata-1-3-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value3"; } else if (val_changed == 'Value2'){ jQuery("#postdata-1-2-post_tag").prop("checked", true); jQuery('label[for="postdata-1-2-post_tag"]').toggleClass('forminator-is_checked'); jQuery("#postdata-1-3-post_tag").prop("checked", true); jQuery('label[for="postdata-1-3-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value3"; } else { jQuery("#postdata-1-3-post_tag").prop("checked", true); jQuery('label[for="postdata-1-3-post_tag"]').toggleClass('forminator-is_checked'); val_changed = "Value3"; } } else { //no value selected, do nothing } } ); }); </script>
I will mark it as resolved.
Thanks for your help.Best,
Benoit
Hi Patrick,
I have only 2 tags options. It is a single tag choice and I have a radio field with exactly these 2 values. I want the post tag to get the value from this radio field value.
Why so you may ask? It’s only because I have conditions in my form and I’m not able to use condition on “post tag field” easily. So I’m using this role field to do so.
Right now I have twice the same question : once for this radio field and another time for the post tag. My idea is only to get the form cleaner and not confuse my clients with the same question ??Thanks !
Benoit
PS : I’ve deleted the access to the file in my drive, but I can publish it again if necessary.
Hi Patrick,
Thanks a lot for your help. I already managed to get some results :
– in order to update the title, I can now update it from select field or date field. Thanks ! I will try to get more complex conditions later (and I’ve tried for curiosity and later improvements from text field too but without success until now). I understood the idea.
– in order to update post tag according to a select field, I have some issues. First of all I managed to make it readonly but only partially with :
$(‘#forminator-field-post_tag-postdata-1 option:not(:selected)’).attr(‘disabled’, true);
But I can still select the first option. Besides, I’ve tried to update the tag post value using the following :
– select2-forminator-field-post_tag-postdata-1-results
– select2-forminator-field-post_tag-postdata-1-container
– post_tag-postdata-1
– forminator-field-post_tag-postdata-1
– ..
without any success. I don’t know if I can force it with the value of another select field (even though the text value are the same) or if I have to set the value of the field like “select2-data-select2-forminator-field-post_tag-postdata-1-result-7w9t-51”Sorry if it sounds stupid, I’m in learning process ??
Thanks anyway for the help you already gave me!
Benoit
PS : for now I changed the loading but later on I might move back to Ajax ..
In details what I want has “complex” conditions but I guess I can adapt myself the code once I get the idea.
Ideally, I would like the title to be populated this way :
– if {date-6} not empty –> title = {select-1} {radio-3} {date-6} “to” {date-7}
– elseif {date-2} not empty –> title = {select-1} {radio-3} {date-1} “…”
– else title = {select-1} {radio-3} {date-1}For the tag, it is simply post_tag = {radio-3}
My tags are already created with the same values as {radio-3} choices.I can either make the title readonly, in that case I will put it after the last field needed. Or I can simply hide it if easier.
Thanks,
Benoit
Hi,
Thanks for your reply.
Here is the link to the form exported :
https://drive.google.com/file/d/1K6qSMjMwtnlctY0l2kGyxgV8-0nDm2YW/view?usp=sharingBest regards,
Benoit
Hi !
First of all, thanks for your answer and sorry for the late reply.
I managed to make it work, I can display the custom fields I want in the post. This is quite powerful. I’m facing some conditional logic issues as I’m including a lot in my forminator form but that part I will hopefully handle it on my side.But I would like some help on a particular point. I’m having 2 data in my form which are basically the post category and the post tag. But I want to use them as conditional logic in my other fields. Until now, I have to ask 2 times the same data : once in post category and once in the field which allows the conditional logic (a checkbox field).
I see 2 options :
– manage to put conditional logic on post data category. I see a conditional field on post_data but I don’t know how this works as post_data contains several fields (title, content, …)
– hide and autofill category or tag based on a field value (the one I will actually be using for my conditional logic and which works fine)Obviously I have matching lists (the category and my conditional field).
Any help ?Thanks.
Best regards,
Benoit
Forum: Plugins
In reply to: [WSHK for WooCommerce] Hide view product button in Customer reviews shortcodeHi again,
Thanks a lot for your support. Finally, it worked just fine with the CSS, my bad.
Great plugin and great support !Benoit
Forum: Plugins
In reply to: [WSHK for WooCommerce] Hide view product button in Customer reviews shortcodeHi,
I’ve tested it and it didn’t change the color.
I’ve desactivated the option from woocommerce “activate reviews with stars” and it still displays the same in the shortcode page (but they are not displayed in product page).I’ve created new customer and gave review but with the same result.
How could we proceed if you want to check directly in my website ?
Thanks for your help,
Regards,
Benoit