Advertisement
shelob9

Untitled

Nov 9th, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. /**
  2.  * Save PDF link of entry, as user as user meta
  3.  */
  4. add_action( 'caldera_forms_submit_complete', function( $form, $referrer, $process_id, $entry_id ) {
  5.     //change your form ID here
  6.     if( 'cf123..' != $form[ 'ID' ] ) {
  7.         return;
  8.     }
  9.  
  10.     $message = \calderawp\calderaforms\pro\container::get_instance()->get_messages_db()->get_by_entry_id( $entry_id );
  11.     if( ! is_wp_error( $message ) ) {
  12.         $link = $message->get_pdf_link();
  13.         update_user_meta( get_current_user_id(), '_last_entry_pdf', $link );
  14.     }
  15.    
  16. }, 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement