add action after flamingo
-
Hello from France,
I’m trying to use the wpcf7_after_flamingo function.
After uploading an image with Drag & Drop Upload plugin and CF7 I’m trying to retrieve the content of postmeta table where the zipped image path is recorded.And then I’d like to update another field of the same postmeta table with a different post_id with this value in orther to change the image displayed with the new one I just uploaded. The problem is that when I try to read the postmeta table where the new image path should be stored there’s a wrong value as if flamingo had not yet recorded the right image path.
This my code :// define the wpcf7_after_flamingo callback function action_wpcf7_after_flamingo( $result ) { $post_id=$_SESSION['post_id']; global $wpdb; global $table_postmeta; $table_postmeta= $wpdb->prefix."postmeta"; //récup post_id $result = $wpdb->get_results("SELECT post_id FROM $table_postmeta WHERE meta_value='new_photo_echantillon' ") ; foreach ($result as $toto) { $post_id_temp= $toto->post_id ; } //récup zip $result = $wpdb->get_results("SELECT meta_value FROM $table_postmeta WHERE post_id='$post_id_temp' AND meta_key = '_field_upload-file-169'") ; foreach ($result as $toto) { $zip= $toto->meta_value ; } // update global $wpdb; $r = $wpdb->update( $table_postmeta, // SET (valeur) array( 'meta_value' => $zip ), // WHERE (valeur) array( 'meta_key' =>'_field_upload-file-868', 'post_id' => $post_id )); } // add the action add_action( 'wpcf7_after_flamingo', 'action_wpcf7_after_flamingo', 10, 1 );
The page I need help with: [log in to see the link]
- The topic ‘add action after flamingo’ is closed to new replies.