Yes, the user did create entries via Form A, but when I enable "Limit options to those created by the current user" for the dynamic field, Form B no longer shows any options for the user to select from Form A. The user is Admin. Did try with other users as well. The form is on a website under development and during testing, we realized that other users could see the entires/fields of different users. Also, i should mention that the form is on a private page, only logged-in users can see it. Thank you.
Who created the entries in Form B and how are they being created? You only answered about Form A. The entries in Form A and Form B must be created by the same user, even if the person is an admin.
The best way to confirm the root cause of your problem is to examine the data in the database. Use PHP admin to examine the entries in wp_frm_items for form Form A and the entries for Form B that are to appear in the lookup and make certain the user_ids in both datasets are the same.
Form A - collects data about the tenant, Form B - collects photos/docs/etc. Entries in Form B are created with a dynamic field that pulls name from Form A plus upload field etc.. If i don't choose the option to limit by a current user it works, but then the dynamic field shows all Form A entries and is viewed by all other users (they see clients that they didn't create) In PHP admin, user_id is correct. Dynamic field is a required option so I've disabled it to check in db the user_id and it is the same. That's why its' strange that it does not work.
I suggest you open a ticket with Strategy 11 support through your Formidable account. Also, make certain you're on V. 6.15.1. There was a bug in 6.15 that impacted lookup fields.
thank you i will do that. For now using the following workaround.
add_filter('frm_setup_new_fields_vars', 'limit_dynamic_field_to_current_user', 20, 2); function limit_dynamic_field_to_current_user($field, $args) { if ($field['type'] == 'data' && $field['id'] == YOUR_DYNAMIC_FIELD_ID) { // Replace with your dynamic field ID // Get the current user ID $current_user_id = get_current_user_id(); // Check if the user is logged in if ($current_user_id) { global $wpdb; // Get the entries submitted by the current user $entries = $wpdb->get_results($wpdb->prepare( "SELECT id FROM {$wpdb->prefix}frm_items WHERE user_id = %d AND form_id = %d", $current_user_id, YOUR_FORM_ID // Replace with the form ID that you are pulling entries from )); // If there are entries, filter the dynamic field options if (!empty($entries)) { $entry_ids = wp_list_pluck($entries, 'id'); $field['options'] = array_intersect_key($field['options'], array_flip($entry_ids)); } else { // No entries found for the current user, make sure the field is empty $field['options'] = array(); } } } return $field; }
Please login or Register to submit your answer