Advertisement
verygoodplugins

Untitled

Sep 14th, 2020
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1.  
  2.  
  3. // WP Fusion functionalit
  4.  
  5. function set_listing_restrictions( $post_id, $post, $update ) {
  6.  
  7.     if ( $post->post_type == 'listing' && function_exists( 'wp_fusion' ) ) {
  8.  
  9.         $settings = array(
  10.             'lock_content'  => true,
  11.             'allow_tags'    => array( 'Listing - ' . $post_id ),
  12.       'redirect'    => 6973,
  13.         );
  14.  
  15.         update_post_meta( $post_id, 'wpf-settings', $settings );
  16.  
  17.         wp_fusion()->user->apply_tags( array( 'Listing - ' . $post_id ) );
  18.  
  19.     }
  20.  
  21. }
  22.  
  23. add_action( 'wp_insert_post', 'set_listing_restrictions', 10, 3 );
  24.  
  25.  
  26. function apply_tags_form_submission( $update_data, $user_id, $contact_id ) {
  27.  
  28.     $data = array(
  29.         'user_id'    => $user_id,
  30.         'listing_id' => $_GET['list_id']
  31.     );
  32.  
  33.     setcookie( 'wpf_nda', json_encode( $data ), time() + MINUTE_IN_SECONDS * 30, COOKIEPATH, COOKIE_DOMAIN );
  34.  
  35. }
  36.  
  37. add_action( 'wpf_gform_post_submission_3', 'apply_tags_form_submission', 10, 3 );
  38. add_action( 'wpf_gform_post_submission_7', 'apply_tags_form_submission', 10, 3 );
  39. add_action( 'wpf_gform_post_submission_8', 'apply_tags_form_submission', 10, 3 );
  40.  
  41.  
  42. function apply_tags_signature_saved( $args ) {
  43.  
  44.     error_log('sig saved ');
  45.     error_log(print_r($args, true));
  46.  
  47.     if( ! function_exists( 'wp_fusion' ) ) {
  48.         return;
  49.     }
  50.  
  51.     if( isset( $_COOKIE['wpf_nda'] ) ) {
  52.  
  53.         $data = json_decode( stripslashes( $_COOKIE['wpf_nda'] ), true );
  54.  
  55.         error_log('got data');
  56.         error_log(print_r($data, true));
  57.  
  58.         wp_fusion()->user->apply_tags( array( 'Listing - ' . $data['listing_id'] ), $data['user_id'] );
  59.  
  60.     }
  61.  
  62. }
  63.  
  64. add_action( 'esig_signature_saved', 'apply_tags_signature_saved' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement