Guest User

affiliates_service_affiliate_id_from_url

a guest
May 22nd, 2015
241
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter ( 'affiliates_service_affiliate_id', 'affiliates_service_affiliate_id_from_url', 10, 2 );
  2.  
  3. function affiliates_service_affiliate_id_from_url ( $affiliate_id, $service )  {
  4.     global $wp, $wpdb;
  5.    
  6.     $pname = get_option( 'aff_pname', AFFILIATES_PNAME );
  7.     $affiliate_id = isset( $_GET[$pname] ) ? affiliates_check_affiliate_id_encoded( trim( $_GET[$pname] ) ) : $affiliate_id;
  8.    
  9.     if ( isset( $_GET[$pname] ) ) {
  10.         // affiliates-by-username uses this hook
  11.         $maybe_affiliate_id = apply_filters( 'affiliates_parse_request_affiliate_id', $_GET[$pname], $affiliate_id );
  12.         if ( ( $maybe_affiliate_id !== null ) && $maybe_affiliate_id !== trim( $_GET[$pname] ) ) {
  13.             $affiliate_id = $maybe_affiliate_id;
  14.         }
  15.     }
  16.     return $affiliate_id;
  17. }
RAW Paste Data