'; $output .= '

'; $output .= __( 'Remove a Referral', 'affiliates' ); $output .= '

'; if ( isset( $_POST['submit'] ) ) { if ( !wp_verify_nonce( $_POST['referral-nonce'], 'remove' ) ) { wp_die( __( 'Access denied.', 'affiliates' ) ); } else { if ( !empty( $_POST['referral_id'] ) ) { // remove the referral $referrals_table = _affiliates_get_tablename( 'referrals' ); if ( $wpdb->query( $wpdb->prepare( "DELETE FROM $referrals_table WHERE referral_id = %d", intval( $_POST['referral_id'] ) ) ) ) { do_action( 'affiliates_deleted_referral', intval( $_POST['referral_id'] ) ); $output .= '
'; $output .= '
'; $output .= __( 'The referral has been removed.', 'affiliates' ); $output .= ' '; $output .= sprintf( '%s', $cancel_url, __( 'Return', 'affiliates' ) ); $output .= '
'; $output .= '
'; } else { $output .= '
' . __( 'I do not know how to delete what does not exist.', 'affiliates' ) . '
'; } } } } else { if ( $referral_id !== null ) { $referrals_table = _affiliates_get_tablename( 'referrals' ); if ( $referrals = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $referrals_table WHERE referral_id = %d", $referral_id ) ) ) { if ( count( $referrals ) > 0 ) { $referral = $referrals[0]; $affiliate_id = $referral->affiliate_id; $datetime = $referral->datetime; $description = wp_strip_all_tags( $referral->description ); $amount = $referral->amount; $currency_id = $referral->currency_id; $status = $referral->status; $reference = wp_strip_all_tags( $referral->reference ); $output .= '
'; $output .= '
'; $output .= sprintf( '', intval( $referral_id ) ); $output .= ''; $output .= '

'; $output .= '' . __( 'Affiliate', 'affiliates' ) . ''; $output .= ' '; $affiliate = affiliates_get_affiliate( $affiliate_id ); $output .= stripslashes( $affiliate['name'] ); $output .= '

'; $output .= '

'; $output .= '' . __( 'Date & Time', 'affiliates' ) . ''; $output .= ' '; $output .= $datetime; $output .= '

'; $output .= '

'; $output .= '' . __( 'Description', 'affiliates' ) . ''; $output .= ' '; $output .= $description; $output .= '

'; $output .= '

'; $output .= '' . __( 'Amount', 'affiliates' ) . ''; $output .= ' '; $output .= $amount; $output .= '

'; $output .= '

'; $output .= '' . __( 'Currency ID', 'affiliates' ) . ''; $output .= ' '; $output .= $currency_id; $output .= '

'; $status_descriptions = array( AFFILIATES_REFERRAL_STATUS_ACCEPTED => __( 'Accepted', 'affiliates' ), AFFILIATES_REFERRAL_STATUS_CLOSED => __( 'Closed', 'affiliates' ), AFFILIATES_REFERRAL_STATUS_PENDING => __( 'Pending', 'affiliates' ), AFFILIATES_REFERRAL_STATUS_REJECTED => __( 'Rejected', 'affiliates' ), ); $output .= '

'; $output .= '' . __( 'Status', 'affiliates' ) . ''; $output .= ' '; $output .= $status_descriptions[$status]; $output .= '

'; $output .= '

'; $output .= '' . __( 'Reference', 'affiliates' ) . ''; $output .= ' '; $output .= $reference; $output .= '

'; $output .= wp_nonce_field( 'remove', 'referral-nonce', true, false ); $output .= '

'; $output .= __( 'Remove this referral? This action can not be undone.', 'affiliates' ); $output .= '

'; $output .= sprintf( '', __( 'Remove', 'affiliates' ) ); $output .= ' '; $output .= sprintf( '%s', $cancel_url, __( 'Cancel', 'affiliates' ) ); $output .= '
'; $output .= '
'; } else { $output .= '
' . __( 'This referral does not exist.', 'affiliates' ) . '
'; } } else { $output .= '
' . __( 'This referral does not exist.', 'affiliates' ) . '
'; } } else { $output .= '
' . __( 'Pretty pointless ...', 'affiliates' ) . '
'; } } $output .= ''; echo $output; affiliates_footer(); }