Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action("gform_after_submission", "calculate_total", 10, 2);
- function calculate_total( $entry, $form ){
- GFCommon::log_debug( __METHOD__ . '(): The Form => ' . print_r( $form, true ) );
- GFCommon::log_debug( __METHOD__ . '(): The Entry => ' . print_r( $entry, true ) );
- global $wpdb;
- $SQL = "UPDATE wp_gf_entry_meta z
- INNER JOIN (
- Select entry_id, meta_value, sum(meta_value) as total FROM wp_gf_entry_meta where form_id='168' and meta_key like '%135' OR meta_key like '%181' OR meta_key like '%296' OR meta_key like '%346' OR meta_key like '%386' OR meta_key like '%426' OR meta_key like '%546'
- group by entry_id
- )
- g on g.entry_id = z.entry_id
- set z.meta_value = g.total
- where z.meta_key='82136' and z.form_id='168'";
- $result = $wpdb->query($SQL);
- GFCommon::log_debug( __METHOD__ . '(): The Result => ' . print_r( $result, true ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement