/** * Return the donor's phone number. * * @return string * @access public * @since 1.4.0 */ public function get_donor_phone() { if (!$this->has_valid_donation()) { return ''; } return $this->donation->get_donor()->get_donor_meta('phone'); }
/** * Return the full name of the donor. * * @return string * @access public * @since 1.0.0 */ public function get_donor_email() { return $this->return_value_if_has_valid_donation($this->donation->get_donor()->get_email()); }
<?php /** * Renders the donation details meta box for the Donation post type. * * @author Studio 164a * @since 1.0.0 */ global $post; $donation = new Charitable_Donation($post); $donor = $donation->get_donor(); ?> <div id="charitable-donation-overview-metabox" class="charitable-metabox"> <div id="donor" class="charitable-media-block"> <div class="donor-avatar charitable-media-image"> <?php echo $donor->get_avatar(80); ?> </div> <div class="donor-facts charitable-media-body"> <h3 class="donor-name"><?php echo $donor->display_name; ?> </h3> <span class="donor-email"><?php echo $donor->get_email(); ?> </span> <?php /** * @hook charitable_donation_details_donor_facts
/** * Verifies whether the current user can access the donation receipt. * * @param Charitable_Donation $donation * @return boolean * @since 1.1.2 */ function charitable_user_can_access_receipt(Charitable_Donation $donation) { /* If the donation key is stored in the session, the user can access this receipt */ if (charitable_get_session()->has_donation_key($donation->get_donation_key())) { return true; } if (!is_user_logged_in()) { return false; } /* Retrieve the donor and current logged in user */ $donor = $donation->get_donor(); $user = wp_get_current_user(); /* Make sure they match */ if ($donor->ID) { return $donor->ID == $user->ID; } return $donor->get_email() == $user->user_email; }
/** * @depends test_add_donation */ public function test_get_donor() { $donation_id = Charitable_Donation_Helper::create_donation(array('campaigns' => array(array('campaign_id' => $this->campaign_1->ID, 'campaign_name' => 'Test Campaign', 'amount' => 10)), 'status' => 'charitable-completed')); $donation = new Charitable_Donation($donation_id); $this->assertInstanceOf('Charitable_User', $donation->get_donor()); }