get_var( $wpdb->prepare( "SELECT user_id FROM $affiliates_users_table WHERE affiliate_id = %d", intval( $affiliate_id ) ) ); if ( $affiliate_user_id !== null ) { $affiliate_user = get_user_by( 'id', intval( $affiliate_user_id ) ); if ( $affiliate_user ) { if ( current_user_can( 'edit_user', $affiliate_user->ID ) ) { $affiliate_user_edit = sprintf( __( 'Edit %s', AFFILIATES_PLUGIN_DOMAIN ) , 'ID" ) . '">' . $affiliate_user->user_login . '' ); } } } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $current_url = remove_query_arg( 'action', $current_url ); $current_url = remove_query_arg( 'affiliate_id', $current_url ); $name = isset( $_POST['name-field'] ) ? $_POST['name-field'] : $affiliate['name']; $email = isset( $_POST['email-field'] ) ? $_POST['email-field'] : $affiliate['email']; $user_login = isset( $_POST['user-field'] ) ? $_POST['user-field'] : ( $affiliate_user != null ? $affiliate_user->user_login : '' ); $from_date = isset( $_POST['from-date-field'] ) ? $_POST['from-date-field'] : $affiliate['from_date']; $thru_date = isset( $_POST['thru-date-field'] ) ? $_POST['thru-date-field'] : $affiliate['thru_date']; $output = '