/**
 * Delete preapproval log when deleting a payment.
 * This is done automatically for standard payments.
 *
 * @since Astoundify Crowdfunding 1.7.2
 *
 * @param int $payment_id The ID of the payment that was deleted.
 * @return void
 */
function atcf_edd_payment_deleted_preapproval($payment_id)
{
    if (!atcf_has_preapproval_gateway()) {
        return $payment_id;
    }
    global $edd_logs;
    $edd_logs->delete_logs(null, 'preapproval', array(array('key' => '_edd_log_payment_id', 'value' => $payment_id)));
}
 /**
  * Campaign Backers Logs
  *
  * Use EDD logs to get all sales. This includes both preapproved
  * payments (if they have Plugin installed) or standard payments.
  *
  * @since Astoundify Crowdfunding 0.1-alpha
  *
  * @param bool $unique
  * @return array Campaign Backers
  */
 public function backers($unique = false)
 {
     global $edd_logs;
     $backers_args = apply_filters('atcf_campaign_backers_args', array('post_parent' => $this->ID, 'log_type' => atcf_has_preapproval_gateway() ? 'preapproval' : 'sale', 'post_status' => array('publish'), 'posts_per_page' => -1));
     $backers = $edd_logs->get_connected_logs($backers_args);
     if (!$backers) {
         return array();
     }
     if ($unique) {
         return $this->unique_backers($backers);
     }
     return $backers;
 }
/**
 * Campaign Contributinos
 *
 * @since Astoundify Crowdfunding 1.4
 *
 * @return void
 */
function atcf_shortcode_profile_contributions($user)
{
    global $edd_options;
    $contributions = edd_get_payments(array('user' => $user->ID, 'status' => atcf_has_preapproval_gateway() ? array('preapproval', 'publish') : 'publish', 'mode' => edd_is_test_mode() ? 'test' : 'live'));
    if (empty($contributions)) {
        return;
    }
    ?>
	<h3 class="atcf-profile-section your-campaigns"><?php 
    _e('Your Contributions', 'atcf');
    ?>
</h3>

	<ul class="atcf-profile-contributinos">
		<?php 
    foreach ($contributions as $contribution) {
        ?>
		<?php 
        $payment_data = edd_get_payment_meta($contribution->ID);
        $cart = edd_get_payment_meta_cart_details($contribution->ID);
        $key = edd_get_payment_key($contribution->ID);
        ?>
		<?php 
        if ($cart) {
            ?>
		<li>
			<?php 
            foreach ($cart as $download) {
                ?>
			<?php 
                printf(_x('<a href="%s">%s</a> pledge to <a href="%s">%s</a>', 'price for download (payment history)', 'atcf'), add_query_arg('payment_key', $key, get_permalink($edd_options['success_page'])), edd_currency_filter(edd_format_amount($download['price'])), get_permalink($download['id']), $download['name']);
                ?>
			<?php 
            }
            ?>
		</li>
		<?php 
        }
        ?>
		<?php 
    }
    ?>
	</ul>
<?php 
}
예제 #4
0
/**
 * No End Date
 *
 * @since Astoundify Crowdfunding 1.7
 *
 * @param $key The key of the current field.
 * @param $field The array of field arguments.
 * @param $args The array of arguments relating to the current state of the campaign
 * @return void
 */
function atcf_shortcode_submit_field_label_length($label)
{
    if (atcf_has_preapproval_gateway()) {
        return $label;
    }
    global $campaign;
    $state = is_object($campaign) ? $campaign->is_endless() : false;
    $state = $state ? ' active' : '';
    return $label . '<a href="#" class="atcf-toggle-neverending' . $state . '">' . __('No End Date', 'atcf') . '</a>';
}
/**
 * @missing
 *
 * @since Astoundify Crowdfunding unknown
 */
function atcf_campaign_type_default()
{
    $type = apply_filters('atcf_campaign_type_default', atcf_has_preapproval_gateway() ? 'fixed' : 'donation');
    return $type;
}