Affiliate Plugin Benutzerlink mit Referrer

In der wp_init.php Datei des Teilnehmerplugins feuert die folgende function, wenn ich einen neuen wordpress Benutzer durch gegebene verbundene URL Url registriere

http://www.example.com/?affiliates= ***

function affiliates_add_referral( $affiliate_id, $post_id, $description = '', $data = null, $amount = null, $currency_id = null, $status = null, $type = null, $reference = null, $hit_id = null ) { global $wpdb; if ( $affiliate_id ) { $current_user = wp_get_current_user(); $now = date('Ymd H:i:s', time() ); $table = _affiliates_get_tablename( 'referrals' ); $columns = "(affiliate_id, post_id, datetime, description"; $formats = "(%d, %d, %s, %s"; $values = array( $affiliate_id, $post_id, $now, $description ); if ( is_user_logged_in()/*!empty( $current_user )*/ ) { $columns .= ",user_id "; $formats .= ",%d "; $values[] = 10;//$current_user->ID; } // add ip $ip_address = $_SERVER['REMOTE_ADDR']; if ( PHP_INT_SIZE >= 8 ) { if ( $ip_int = ip2long( $ip_address ) ) { $columns .= ',ip '; $formats .= ',%d '; $values[] = $ip_int; } } else { if ( $ip_int = ip2long( $ip_address ) ) { $ip_int = sprintf( '%u', $ip_int ); $columns .= ',ip'; $formats .= ',%s'; $values[] = $ip_int; } } if ( is_array( $data ) && !empty( $data ) ) { $columns .= ",data "; $formats .= ",%s "; $values[] = serialize( $data ); } if ( !empty( $amount ) && !empty( $currency_id ) ) { if ( $amount = Affiliates_Utility::verify_referral_amount( $amount ) ) { if ( $currency_id = Affiliates_Utility::verify_currency_id( $currency_id ) ) { $columns .= ",amount "; $formats .= ",%s "; $values[] = $amount; $columns .= ",currency_id "; $formats .= ",%s "; $values[] = $currency_id; } } } if ( !empty( $status ) && Affiliates_Utility::verify_referral_status_transition( $status, $status ) ) { $columns .= ',status '; $formats .= ',%s '; $values[] = $status; } else { $columns .= ',status '; $formats .= ',%s '; $values[] = get_option( 'aff_default_referral_status', AFFILIATES_REFERRAL_STATUS_ACCEPTED ); } if ( !empty( $type ) ) { $columns .= ',type '; $formats .= ',%s'; $values[] = $type; } if ( !empty( $reference ) ) { $columns .= ',reference '; $formats .= ',%s'; $values[] = $reference; } if ( !empty( $hit_id ) ) { $columns .= ',hit_id '; $formats .= ',%d'; $values[] = intval( $hit_id ); } $columns .= ")"; $formats .= ")"; // add the referral $keys = explode( ',', str_replace( ' ', '', substr( $columns, 1, strlen( $columns ) - 2 ) ) ); $referral_data = array_combine( $keys, $values ); $record_referral = apply_filters( 'affiliates_record_referral', true, $referral_data ); if ( $record_referral ) { if ( !affiliates_is_duplicate_referral( compact( 'affiliate_id', 'amount', 'currency_id', 'type', 'reference', 'data' ) ) ) { $query = $wpdb->prepare( "INSERT INTO $table $columns VALUES $formats", $values ); if ( $wpdb->query( $query ) !== false ) { if ( $referral_id = $wpdb->get_var( "SELECT LAST_INSERT_ID()" ) ) { do_action( 'affiliates_referral', $referral_id, array( 'affiliate_id' => $affiliate_id, 'post_id' => $post_id, 'description' => $description, 'data' => $data, 'amount' => $amount, 'currency_id' => $currency_id, 'status' => $status, 'type' => $type, 'reference' => $reference, 'hit_id' => $hit_id ) ); } } } } } return $affiliate_id; } 

Die Benutzer-ID, die in der Verweistabelle abgelegt wurde, ist null oder null.

So, wie diese function aufgerufen wird, sollte Benutzer-ID neu Benutzer-ID erstellt werden.

Solutions Collecting From Web of "Affiliate Plugin Benutzerlink mit Referrer"