Forum Replies Created
-
AuthorPosts
-
March 10, 2018 at 10:21 PM in reply to: ✅Conditional Logic not seems working with multiple metaboxes on front-end #8771
jcleaveland
ParticipantI think I'm having the same issue. I thought it was me.
I've tried it both ways below with no success. I can get a field to be hidden with only one condition like this:
array( 'id' => $prefix . 'services', 'name' => esc_html__( 'Services', 'obh' ), 'type' => 'taxonomy', 'placeholder' => esc_html__( 'Select Services', 'obh' ), 'taxonomy' => 'obh_note_services', 'field_type' => 'checkbox_list', 'inline' => true, 'columns' => 6, 'query_args' => array( 'meta_key' => 'obh_active_tax_selector', 'meta_value' => 'yes', 'orderby' => 'meta_value_num', 'order' => 'ASC', ), 'visible' => array( 'obh_note_type', '78' ), 'toggle_type' => 'fade'**The numbers are the ID of the term that is displayed as the field value in the form
But, I cannot get multiple conditions to work. I've tried both of these methods (obviously not at the same time):
'visible' => array( 'tax_query[note-type]', 'in', array( 78, 79 ) ), 'when' => array( array( 'obh_note_type', 78), array( 'obh_note_type', 79), array( 'obh_note_type', 80), array( 'obh_note_type', 81), array( 'obh_note_type', 82), array( 'obh_note_type', 83), array( 'obh_note_type', 84), ), ), 'relation' => 'or', 'toggle_type' => 'fade'Thanks for your help!
jcleaveland
ParticipantI'm replying here to receive email updates and follow the conversation. No need for other response.
Thanks!
jcleaveland
ParticipantNo worries. This will work fine. I was just wondering if I should be planning for something different coming soon.
Thanks for all your help!
jcleaveland
ParticipantPerfect. Thank you!
Any plans to support meta queries in the future?
jcleaveland
ParticipantThat could work. I'll try that out.
I like the proposed solution for a new parameter, 'save_values_as' => 'json|csv|multiple' I think that will simplify things for my use case significantly.
I'll keep my eyes peeled for updates on the Git issue.
Thank you!
jcleaveland
ParticipantI updated and everything works as expected.
Thanks for the great support!
jcleaveland
ParticipantThis is great!
Yes, insert_post_data was too generic. This is much better.
I ended up with a simple check on the content of the fields prior to executing the code, but this is more elegant and more flexible in the long run.
function set_member_title( $data ) { if($data['post_type'] === 'obh_member_meta' && $data['post_date_gmt'] !== data['post_modified_gmt'] ) { $first_name = $_POST['obh_member_meta_contact_first_name']; $last_name = $_POST['obh_member_meta_contact_last_name']; if (isset($first_name) || isset($last_name) ) { $title = $first_name . ' ' . $last_name; $post_slug = sanitize_title_with_dashes ($title,'','save'); $post_slugsan = sanitize_title($post_slug); $data['post_title'] = $title; $data['post_name'] = $post_slugsan; return $data; } } } add_filter( 'wp_insert_post_data' , 'set_member_title' , '99', 2 );Thank you!
jcleaveland
ParticipantWell... Another case of misplaced closing parenthesis.
I had the array saved one level too deep in the fields array. It was placed at the bottom of a group array before the field ID was declared.
Please close this one.
Thanks!
September 9, 2017 at 11:26 AM in reply to: Conditional Logic does not work with MB Frontend Submission #6935jcleaveland
ParticipantAw shoot... As soon as I posted this I realized the problem. I have the "Yes" as the value for the option capitalized and the "yes" for the visibility option lowercase.
All works as expected now.
Thanks for the update!
September 9, 2017 at 11:22 AM in reply to: Conditional Logic does not work with MB Frontend Submission #6934jcleaveland
ParticipantJust installed the newest version and I'm not having any luck front-end or back-end.
It is writing both "display:none" and "visibility:hidden" to the hidden divs.
Example:
<div class="rwmb-field rwmb-select-wrapper" data-visible="hidden" style="display: none;visibility: hidden;"><div class="rwmb-label">It seems like that should not be the case. If I remove the inline styles in the dev tools, I can get them to appear.
Here is a sample of one of my conditional fields for reference:
array( 'id' => $prefix . 'financial_assistance_choice', 'name' => esc_html__( 'Did you provide financial assistance or an incentive?', 'obh' ), 'type' => 'radio', 'placeholder' => '', 'options' => array( esc_html_x( 'Yes', 'Value for radio select', 'obh' ) => esc_html__( 'Yes', 'obh' ), esc_html_x( 'No', 'Value for radio select', 'obh' ) => esc_html__( 'No', 'obh' ), ), 'inline' => true, ), array( 'id' => $prefix . 'financial_assistance_types', 'name' => esc_html__( 'Which type of assistance?', 'obh' ), 'type' => 'select', 'placeholder' => 'Select the Assistance Type', 'visible' => [ $prefix . 'financial_assistance_choice', '=', 'yes'], 'options' => obh_print_at_field_vars(), 'toggle_type' => 'visibility' ),I recently added the "toggle_type" setting as an attempted remedy but it did not solve the issue.
Thoughts?
September 7, 2017 at 6:37 AM in reply to: Conditional Logic does not work with MB Frontend Submission #6917jcleaveland
ParticipantHi,
Is there any update on conditional logic for front-end forms?
Thanks!
jcleaveland
ParticipantHi,
Forgive the delay. I must not have checked the "email me updates" checkbox.
You are correct. It only affects the first meta-box edited. Others can be edited effectively. The only issue is if the user wants to edit the recently saved fields - they need to refresh the page without the URL param.
Perhaps an update to the plugin would allow developers to specify the redirect similar to the way that they can specify the message. In my case, sometimes, I'd like to redirect to a "success" page that would allow the user to decide where to go next. Other times, a full refresh of the page with a javascript success message would be nice.
We can close this for now. I will not worry about this until the next release of my theme.
Thanks!
August 7, 2017 at 10:25 PM in reply to: Conditional Logic does not work with MB Frontend Submission #6547jcleaveland
ParticipantI have the same issue. I am commenting here to receive the follow-up reply when the update is complete. No need for any other response.
Thanks for the great support!
jcleaveland
ParticipantHi,
I am using this method to join two meta fields (first and last name) and insert them as the title. I am using a front-end form to make changes. The front-end form works well and all of the data is captured as expected. I am having problems with the function to insert the post title though. I am using this:
function set_member_meta_title( $data , $postarr ) { if($data['post_type'] == 'obh_member_meta') { $first_name = get_post_meta($postarr['ID'],'obh_member_first_name',true); $last_name = get_post_meta($postarr['ID'], 'obh_member_last_name' , true); $title = $first_name . ' ' . $last_name; $post_slug = sanitize_title_with_dashes ($title,'','save'); $post_slugsan = sanitize_title($post_slug); $data['post_title'] = $title; $data['post_name'] = $post_slugsan; } return $data; } add_filter( 'wp_insert_post_data' , 'set_member_meta_title' , '500', 2 );The funny thing is that it inserts the last value for the fields. For instance if I save Joe as the first name, it does nothing, but when I go back and change Joe to Frank, it writes Joe as the title while changing the actual first name in the DB to Frank.
I thought it was a priority issue so I have played with them from 1-999 with little to no effect.
I'm at a loss. Any thoughts?
Thanks!
June 21, 2017 at 9:43 PM in reply to: "Oops something went wrong" in Address field on example.php meta box #6140jcleaveland
ParticipantActually, it's PHP 5.6! Sorry
-
AuthorPosts