- This topic has 0 replies, 1 voice, and was last updated 5 years, 5 months ago by
dealerconsulting.
Viewing 0 reply threads
-
AuthorPosts
-
-
September 9, 2016 at 5:11 am #7329
dealerconsultingParticipantDear all!
I’m glad to use piklist plugin and very apprieciative for your job.
I’ve encountered the problem after upgrading to v.0.9.9.9 .
Please look at the code below.
11th line indicates an errorInvalid argument supplied for foreach()
.
foreach ($fields[$key][‘request_value’] as $id)
add_action( 'piklist_save_field', 'my_save_post', 10, 2 ); function my_save_post($scope, $fields) { global $wpdb; if ($scope == 'relate-reverse') { foreach ($fields as $key => $value) { if (substr_compare($key, '_relate_id', -strlen('_relate_id'), strlen('_relate_id')) === 0) { foreach ($fields[$key]['request_value'] as $id) { foreach ($fields as $key => $value) { if (substr_compare($key, '_post_id', -strlen('_post_id'), strlen('_post_id')) === 0) { foreach ($fields[$key]['request_value'] as $post_ids) { foreach ($post_ids as $post_id) { PikList_Form::relate($post_id, array($id)); } } } if (substr_compare($key, '_relate_remove', -strlen('_relate_remove'), strlen('_relate_remove')) === 0) { $remove = array_filter(explode(',', $fields[$key]['request_value'][0])); foreach ($remove as $has) { if ($found = $wpdb->get_var($wpdb->prepare("SELECT relate_id FROM {$wpdb->prefix}post_relationships WHERE post_id = %d AND has_post_id = %d", $has, $id))) { $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}post_relationships WHERE relate_id = %d", $found)); } } } } } } } } }Thank you for your support.
Regards,
Arek
-
-
AuthorPosts
Viewing 0 reply threads
- You must be logged in to reply to this topic.