PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / templates / shortcodes / my-donations.php

my-donations.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at templates/shortcodes/my-donations.php

188 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays a table of the user's donations, with links to the donation receipts.
4 *
5 * Override this template by copying it to yourtheme/charitable/shortcodes/my-donations.php
6 *
7 * @author WP Charitable LLC
8 * @package Charitable/Templates/Account
9 * @since 1.4.0
10 * @version 1.6.19
11 * @version 1.8.8.6
12 */
13
14 // Exit if accessed directly.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 $charitable_user = array_key_exists( 'user', $view_args ) ? $view_args['user'] : charitable_get_user( get_current_user_id() );
20 $charitable_donations = $view_args['donations'];
21
22 /**
23 * Do something before rendering the donations.
24 *
25 * @param object[] $donations An array of donations as a simple object.
26 * @param array $view_args All args passed to template.
27 */
28 do_action( 'charitable_my_donations_before', $charitable_donations, $view_args );
29
30 if ( empty( $charitable_donations ) ) : ?>
31
32 <p><?php esc_html_e( 'You have not made any donations yet.', 'charitable' ); ?></p>
33
34 <?php else : ?>
35
36 <table class="charitable-my-donations charitable-table">
37 <thead>
38 <tr>
39 <th scope="col"><?php esc_html_e( 'Date', 'charitable' ); ?></th>
40 <?php
41 /**
42 * Add a column header after the donation date header. Any output should be wrapped in <th></th>.
43 *
44 * @since 1.5.0
45 *
46 * @param object[] $donations An array of donations as a simple object.
47 * @param array $view_args All args passed to template.
48 */
49 do_action( 'charitable_my_donations_table_header_after_date', $charitable_donations, $view_args );
50 ?>
51 <th scope="col"><?php esc_html_e( 'Campaign', 'charitable' ); ?></th>
52 <?php
53 /**
54 * Add a column header after the campaign header. Any output should be wrapped in <th></th>.
55 *
56 * @since 1.5.0
57 *
58 * @param object[] $donations An array of donations as a simple object.
59 * @param array $view_args All args passed to template.
60 */
61 do_action( 'charitable_my_donations_table_header_after_campaigns', $charitable_donations, $view_args );
62 ?>
63 <th scope="col"><?php esc_html_e( 'Amount', 'charitable' ); ?></th>
64 <?php
65 /**
66 * Add a column header after the amount header. Any output should be wrapped in <th></th>.
67 *
68 * @since 1.5.0
69 *
70 * @param object[] $donations An array of donations as a simple object.
71 * @param array $view_args All args passed to template.
72 */
73 do_action( 'charitable_my_donations_table_header_after_amount', $charitable_donations, $view_args );
74 ?>
75 <th scope="col"><?php esc_html_e( 'Status', 'charitable' ); ?></th>
76 <?php
77 /**
78 * Add a column header after the status header. Any output should be wrapped in <th></th>.
79 *
80 * @since 1.5.4
81 *
82 * @param object[] $donations An array of donations as a simple object.
83 */
84 do_action( 'charitable_my_donations_table_header_after_status', $charitable_donations );
85 ?>
86 <th scope="col"><?php esc_html_e( 'Receipt', 'charitable' ); ?></th>
87 <?php
88 /**
89 * Add a column header after the receipt header. Any output should be wrapped in <th></th>.
90 *
91 * @since 1.5.0
92 *
93 * @param object[] $donations An array of donations as a simple object.
94 * @param array $view_args All args passed to template.
95 */
96 do_action( 'charitable_my_donations_table_header_after_receipt', $charitable_donations, $view_args );
97 ?>
98 </tr>
99 </thead>
100 <tbody>
101 <?php foreach ( $charitable_donations as $charitable_donation ) : ?>
102 <tr>
103 <td><?php echo esc_html( mysql2date( 'F j, Y', get_post_field( 'post_date', $charitable_donation->ID ) ) ); ?></td>
104 <?php
105 /**
106 * Add a cell after the donation date. Any output should be wrapped in <td></td>.
107 *
108 * @since 1.5.0
109 *
110 * @param object $donation The donation as a simple object.
111 * @param array $view_args All args passed to template.
112 */
113 do_action( 'charitable_my_donations_table_after_date', $charitable_donation );
114 ?>
115 <td><?php echo esc_html( $charitable_donation->campaigns ); ?></td>
116 <?php
117 /**
118 * Add a cell after the list of campaigns. Any output should be wrapped in <td></td>.
119 *
120 * @since 1.5.0
121 *
122 * @param object $donation The donation as a simple object.
123 * @param array $view_args All args passed to template.
124 */
125 do_action( 'charitable_my_donations_table_after_campaigns', $charitable_donation );
126 ?>
127 <td class="amount" data-title="<?php esc_attr_e( 'Amount', 'charitable' ); ?>">
128 <?php
129 /**
130 * Filter the total donation amount.
131 *
132 * @since 1.6.19
133 *
134 * @param string $amount The total donation amount.
135 * @param object $donation The donation as a simple object.
136 */
137 echo esc_html( apply_filters( 'charitable_my_donation_total_amount', charitable_format_money( $charitable_donation->amount ), $charitable_donation ) );
138 ?>
139 </td>
140 <?php
141 /**
142 * Add a cell after the donation amount. Any output should be wrapped in <td></td>.
143 *
144 * @since 1.5.0
145 *
146 * @param object $donation The donation as a simple object.
147 * @param array $view_args All args passed to template.
148 */
149 do_action( 'charitable_my_donations_table_after_amount', $charitable_donation );
150 ?>
151 <td><?php echo esc_html( charitable_get_donation( $charitable_donation->ID )->get_status_label() ); ?></td>
152 <?php
153 /**
154 * Add a cell after the donation status. Any output should be wrapped in <td></td>.
155 *
156 * @since 1.5.4
157 *
158 * @param object $donation The donation as a simple object.
159 */
160 do_action( 'charitable_my_donations_table_after_status', $charitable_donation );
161 ?>
162 <td><a href="<?php echo esc_url( charitable_get_permalink( 'donation_receipt_page', array( 'donation_id' => $charitable_donation->ID ) ) ); ?>"><?php esc_html_e( 'View Receipt', 'charitable' ); ?></a></td>
163 <?php
164 /**
165 * Add a cell after the link to the receipt. Any output should be wrapped in <td></td>.
166 *
167 * @since 1.5.0
168 *
169 * @param object $donation The donation as a simple object.
170 * @param array $view_args All args passed to template.
171 */
172 do_action( 'charitable_my_donations_table_after_receipt', $charitable_donation, $view_args );
173 ?>
174 </tr>
175 <?php endforeach ?>
176 </tbody>
177 </table>
178 <?php
179 endif;
180
181 /**
182 * Do something after rendering the donations.
183 *
184 * @param object[] $donations An array of donations as a simple object.
185 * @param array $view_args All args passed to template.
186 */
187 do_action( 'charitable_my_donations_after', $charitable_donations, $view_args );
188