function test_get_metadata() { $this->assertEmpty(affwp_get_affiliate_meta($this->_affiliate_id)); $this->assertEmpty(affwp_get_affiliate_meta($this->_affiliate_id, 'key_that_does_not_exist', true)); affwp_update_affiliate_meta($this->_affiliate_id, 'test_key_2', '1'); $this->assertEquals('1', affwp_get_affiliate_meta($this->_affiliate_id, 'test_key_2', true)); $this->assertInternalType('array', affwp_get_affiliate_meta($this->_affiliate_id, 'test_key_2', false)); }
/** * Email template tag: affwp_email_tag_rejection_reason * The affiliate rejection reason * * @param int $affiliate_id * @return string rejection_reason */ function affwp_email_tag_rejection_reason($affiliate_id = 0) { $reason = affwp_get_affiliate_meta($affiliate_id, '_rejection_reason', true); if (empty($reason)) { $reason = __('No reason provided', 'affiliate-wp'); } return $reason; }
<?php $affiliate = affwp_get_affiliate(absint($_GET['affiliate_id'])); $user_info = get_userdata($affiliate->user_id); $rate_type = !empty($affiliate->rate_type) ? $affiliate->rate_type : ''; $rate = isset($affiliate->rate) ? $affiliate->rate : null; $rate = affwp_abs_number_round($affiliate->rate); $default_rate = affiliate_wp()->settings->get('referral_rate', 20); $default_rate = affwp_abs_number_round($default_rate); $email = !empty($affiliate->payment_email) ? $affiliate->payment_email : ''; $reason = affwp_get_affiliate_meta($affiliate->affiliate_id, '_rejection_reason', true); ?> <div class="wrap"> <h2><?php _e('Edit Affiliate', 'affiliate-wp'); ?> </h2> <form method="post" id="affwp_edit_affiliate"> <?php do_action('affwp_edit_affiliate_top', $affiliate); ?> <table class="form-table"> <tr class="form-row form-required"> <th scope="row"> <label for="affiliate_id"><?php