Advertisement
verygoodplugins

Untitled

Aug 16th, 2019
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. function merge_affiliate_name( $update_data, $user_id, $contact_id, $form_id ) {
  2.  
  3.     if ( isset( $_COOKIE['affwp_ref'] ) ) {
  4.  
  5.         $affiliate = affwp_get_affiliate( $_COOKIE['affwp_ref'] );
  6.  
  7.         $userdata = get_userdata( $affiliate->user_id );
  8.  
  9.         $update_data['Field Name'] = $userdata->first_name . ' ' . $userdata->last_name;
  10.  
  11.     }
  12.  
  13.     return $update_data;
  14.  
  15. }
  16.  
  17. add_filter( 'wpf_forms_pre_submission', 'merge_affiliate_name', 10, 4 );
  18.  
  19. function merge_affiliate_tags( $apply_tags, $user_id, $contact_id ) {
  20.  
  21.     if ( isset( $_COOKIE['affwp_ref'] ) ) {
  22.  
  23.         $apply_tags[] = 'Affiliate Tag';
  24.  
  25.     } else {
  26.  
  27.         $apply_tags[] = 'Not Affiliate';
  28.  
  29.     }
  30.  
  31.     return $apply_tags;
  32.  
  33. }
  34.  
  35. add_filter( 'wpf_forms_apply_tags', 'merge_affiliate_tags', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement